Class: Tochtli::Test::MemoryCache
- Inherits:
-
Object
- Object
- Tochtli::Test::MemoryCache
- Defined in:
- lib/tochtli/test/memory_cache.rb
Overview
a simple proxy to replicate ActiveSupport cache interface using mini store
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
-
#initialize ⇒ MemoryCache
constructor
A new instance of MemoryCache.
- #read(name) ⇒ Object
- #write(name, value) ⇒ Object
Constructor Details
#initialize ⇒ MemoryCache
Returns a new instance of MemoryCache.
9 10 11 |
# File 'lib/tochtli/test/memory_cache.rb', line 9 def initialize @store = MiniCache::Store.new end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
7 8 9 |
# File 'lib/tochtli/test/memory_cache.rb', line 7 def store @store end |
Instance Method Details
#read(name) ⇒ Object
17 18 19 |
# File 'lib/tochtli/test/memory_cache.rb', line 17 def read(name) store.get(name) end |
#write(name, value) ⇒ Object
13 14 15 |
# File 'lib/tochtli/test/memory_cache.rb', line 13 def write(name, value) store.set(name, value) end |