Class: Blix::Rest::MemoryCache
- Inherits:
-
Cache
- Object
- Cache
- Blix::Rest::MemoryCache
show all
- Defined in:
- lib/blix/rest/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
54
55
56
|
# File 'lib/blix/rest/cache.rb', line 54
def cache
@cache ||= {}
end
|
#clear ⇒ Object
66
67
68
|
# File 'lib/blix/rest/cache.rb', line 66
def clear
cache.clear
end
|
#delete(key) ⇒ Object
74
75
76
|
# File 'lib/blix/rest/cache.rb', line 74
def delete(key)
cache.delete(key)
end
|
#get(key) ⇒ Object
58
59
60
|
# File 'lib/blix/rest/cache.rb', line 58
def get(key)
cache[key]
end
|
#key?(key) ⇒ Boolean
70
71
72
|
# File 'lib/blix/rest/cache.rb', line 70
def key?(key)
cache.key?(key)
end
|
#set(key, data) ⇒ Object
62
63
64
|
# File 'lib/blix/rest/cache.rb', line 62
def set(key, data)
cache[key] = data
end
|