Class: BooticClient::Stores::Memcache

Inherits:
Object
  • Object
show all
Defined in:
lib/bootic_client/stores/memcache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_hosts, dalli_options = {}) ⇒ Memcache

Returns a new instance of Memcache.



8
9
10
# File 'lib/bootic_client/stores/memcache.rb', line 8

def initialize(server_hosts, dalli_options = {})
  @client = Dalli::Client.new(Array(server_hosts), dalli_options)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/bootic_client/stores/memcache.rb', line 6

def client
  @client
end

Instance Method Details

#delete(key) ⇒ Object



24
25
26
# File 'lib/bootic_client/stores/memcache.rb', line 24

def delete(key)
  @client.delete key
end

#get(key) ⇒ Object



20
21
22
# File 'lib/bootic_client/stores/memcache.rb', line 20

def get(key)
  @client.get key
end

#read(key) ⇒ Object



12
13
14
# File 'lib/bootic_client/stores/memcache.rb', line 12

def read(key)
  @client.get key.to_s
end

#set(key, data, ttl = nil) ⇒ Object



28
29
30
# File 'lib/bootic_client/stores/memcache.rb', line 28

def set(key, data, ttl = nil)
  @client.set key, data, ttl
end

#statsObject



32
33
34
# File 'lib/bootic_client/stores/memcache.rb', line 32

def stats
  @client.stats
end

#write(key, data, ttl = nil) ⇒ Object



16
17
18
# File 'lib/bootic_client/stores/memcache.rb', line 16

def write(key, data, ttl = nil)
  @client.set key.to_s, data, ttl
end