public Method

MemCache.flush_all

Flush the cache from all memcache servers.

Source Code

# File active_support/vendor/memcache-client-1.5.0/memcache.rb, line 403
def flush_all
  raise MemCacheError, 'No active servers' unless active?
  raise MemCacheError, "Update of readonly cache" if @readonly
  begin
    @mutex.lock if @multithread
    @servers.each do |server|
      begin
        sock = server.socket
        raise MemCacheError, "No connection to server" if sock.nil?
        sock.write "flush_all\r\n"
        result = sock.gets
        raise_on_error_response! result
        result
      rescue SocketError, SystemCallError, IOError => err
        server.close
        raise MemCacheError, err.message
      end
    end
  ensure
    @mutex.unlock if @multithread
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.