Class: AccessToken::MemcachedStore
- Inherits:
-
Object
- Object
- AccessToken::MemcachedStore
- Defined in:
- lib/access_token/memcached_store.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #del(key) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(client = Dalli::Client.new) ⇒ MemcachedStore
constructor
A new instance of MemcachedStore.
- #key?(key) ⇒ Boolean
- #set(key, value, ttl) ⇒ Object
Constructor Details
#initialize(client = Dalli::Client.new) ⇒ MemcachedStore
Returns a new instance of MemcachedStore.
5 6 7 |
# File 'lib/access_token/memcached_store.rb', line 5 def initialize(client = Dalli::Client.new) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/access_token/memcached_store.rb', line 3 def client @client end |
Instance Method Details
#del(key) ⇒ Object
17 18 19 |
# File 'lib/access_token/memcached_store.rb', line 17 def del(key) client.delete(key) end |
#get(key) ⇒ Object
13 14 15 |
# File 'lib/access_token/memcached_store.rb', line 13 def get(key) client.get(key) end |
#key?(key) ⇒ Boolean
21 22 23 |
# File 'lib/access_token/memcached_store.rb', line 21 def key?(key) client.get(key) != nil end |
#set(key, value, ttl) ⇒ Object
9 10 11 |
# File 'lib/access_token/memcached_store.rb', line 9 def set(key, value, ttl) client.set(key, value) end |