Class: AccessToken::MemcachedStore

Inherits:
Object
  • Object
show all
Defined in:
lib/access_token/memcached_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (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

Returns:

  • (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