Class: Blix::Rest::MemoryCache
- Inherits:
-
Cache
- Object
- Cache
- Blix::Rest::MemoryCache
show all
- Defined in:
- lib/blix/rest/memory_cache.rb
Overview
implement cache as a simple ruby hash
Instance Attribute Summary
Attributes inherited from Cache
#params
Instance Method Summary
collapse
Methods inherited from Cache
#[], #[]=, #initialize
Instance Method Details
#cache ⇒ Object
5
6
7
|
# File 'lib/blix/rest/memory_cache.rb', line 5
def cache
@cache ||= {}
end
|
#clear ⇒ Object
17
18
19
|
# File 'lib/blix/rest/memory_cache.rb', line 17
def clear
cache.clear
end
|
#delete(key) ⇒ Object
25
26
27
|
# File 'lib/blix/rest/memory_cache.rb', line 25
def delete(key)
cache.delete(key)
end
|
#get(key) ⇒ Object
9
10
11
|
# File 'lib/blix/rest/memory_cache.rb', line 9
def get(key)
cache[key]
end
|
#key?(key) ⇒ Boolean
21
22
23
|
# File 'lib/blix/rest/memory_cache.rb', line 21
def key?(key)
cache.key?(key)
end
|
#set(key, data) ⇒ Object
13
14
15
|
# File 'lib/blix/rest/memory_cache.rb', line 13
def set(key, data)
cache[key] = data
end
|