instance method delete

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

delete(key, expiry = 0)

Removes key from the cache in expiry seconds.

Parameters

key req
expiry opt = 0
Source
# File activesupport/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb, line 377
  def delete(key, expiry = 0)
    @mutex.lock if @multithread

    raise MemCacheError, "No active servers" unless active?
    cache_key = make_cache_key key
    server = get_server_for_key cache_key

    sock = server.socket
    raise MemCacheError, "No connection to server" if sock.nil?

    begin
      sock.write "delete #{cache_key} #{expiry}\r\n"
      result = sock.gets
      raise_on_error_response! result
      result
    rescue SocketError, SystemCallError, IOError => err
      server.close
      raise MemCacheError, err.message
    end
  ensure
    @mutex.unlock if @multithread
  end

Defined in activesupport/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb line 377 · View on GitHub · Improve this page · Find usages on GitHub

Defined in MemCache

Type at least 2 characters to search.

↑↓ navigate · open · esc close