Class: LockBoxCache::Cache::HashCache
- Inherits:
-
Object
- Object
- LockBoxCache::Cache::HashCache
- Defined in:
- lib/lockbox_cache.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #delete(key) ⇒ Object
-
#initialize ⇒ HashCache
constructor
A new instance of HashCache.
- #read(key) ⇒ Object
- #write(key, value) ⇒ Object
Constructor Details
#initialize ⇒ HashCache
Returns a new instance of HashCache.
9 10 11 |
# File 'lib/lockbox_cache.rb', line 9 def initialize @store = Hash.new end |
Instance Method Details
#clear ⇒ Object
25 26 27 |
# File 'lib/lockbox_cache.rb', line 25 def clear @store = {} end |
#delete(key) ⇒ Object
21 22 23 |
# File 'lib/lockbox_cache.rb', line 21 def delete(key) @store.delete(key) end |
#read(key) ⇒ Object
17 18 19 |
# File 'lib/lockbox_cache.rb', line 17 def read(key) @store[key] end |
#write(key, value) ⇒ Object
13 14 15 |
# File 'lib/lockbox_cache.rb', line 13 def write(key, value) @store[key] = value end |