Class Wrest::Components::CacheStore::Memcached

  1. lib/wrest/components/cache_store/memcached.rb
Parent: Object

Methods

public class

  1. new

public instance

  1. []
  2. []=
  3. delete

Public class methods

new (server_urls=nil, options={})
[show source]
    # File lib/wrest/components/cache_store/memcached.rb, line 13
13:     def initialize(server_urls=nil, options={})
14:       @memcached = Dalli::Client.new(server_urls, options)
15:     end

Public instance methods

[] (key)
[show source]
    # File lib/wrest/components/cache_store/memcached.rb, line 17
17:     def [](key)
18:       @memcached.get(key)
19:     end
[]= (key, value)
[show source]
    # File lib/wrest/components/cache_store/memcached.rb, line 21
21:     def []=(key, value)
22:       @memcached.set(key, value)
23:     end
delete (key)

should be compatible with Hash - return value of the deleted element.

[show source]
    # File lib/wrest/components/cache_store/memcached.rb, line 26
26:     def delete(key)
27:       value = self[key]
28:       
29:       @memcached.delete key
30: 
31:       return value
32:     end