Class: Cash::Adapter::MemcacheClient
- Inherits:
-
Object
- Object
- Cash::Adapter::MemcacheClient
show all
- Defined in:
- lib/cash/adapter/memcache_client.rb
Instance Method Summary
collapse
Constructor Details
#initialize(repository, options = {}) ⇒ MemcacheClient
Returns a new instance of MemcacheClient.
6
7
8
9
10
|
# File 'lib/cash/adapter/memcache_client.rb', line 6
def initialize(repository, options = {})
@repository = repository
@logger = options[:logger]
@default_ttl = options[:default_ttl] || raise(":default_ttl is a required option")
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
30
31
32
|
# File 'lib/cash/adapter/memcache_client.rb', line 30
def method_missing(*args, &block)
@repository.send(*args, &block)
end
|
Instance Method Details
#add(key, value, ttl = nil, raw = false) ⇒ Object
12
13
14
|
# File 'lib/cash/adapter/memcache_client.rb', line 12
def add(key, value, ttl=nil, raw=false)
@repository.add(key, value, ttl || @default_ttl, raw)
end
|
#exception_classes ⇒ Object
20
21
22
|
# File 'lib/cash/adapter/memcache_client.rb', line 20
def exception_classes
MemCache::MemCacheError
end
|
#respond_to?(method) ⇒ Boolean
24
25
26
|
# File 'lib/cash/adapter/memcache_client.rb', line 24
def respond_to?(method)
super || @repository.respond_to?(method)
end
|
#set(key, value, ttl = nil, raw = false) ⇒ Object
16
17
18
|
# File 'lib/cash/adapter/memcache_client.rb', line 16
def set(key, value, ttl=nil, raw=false)
@repository.set(key, value, ttl || @default_ttl, raw)
end
|