Class: CacheStoreApi::TestCache
- Inherits:
-
Object
- Object
- CacheStoreApi::TestCache
- Defined in:
- lib/cache-store-api/test_cache.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #delete(key, options = nil) ⇒ Object
- #exist?(key, options = nil) ⇒ Boolean
-
#initialize ⇒ TestCache
constructor
A new instance of TestCache.
- #read(key, options = nil) ⇒ Object
- #write(key, value, options = nil) ⇒ Object
Constructor Details
#initialize ⇒ TestCache
Returns a new instance of TestCache.
4 5 6 |
# File 'lib/cache-store-api/test_cache.rb', line 4 def initialize @data = {} end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/cache-store-api/test_cache.rb', line 3 def data @data end |
Instance Method Details
#delete(key, options = nil) ⇒ Object
16 17 18 |
# File 'lib/cache-store-api/test_cache.rb', line 16 def delete(key, = nil) data.delete key end |
#exist?(key, options = nil) ⇒ Boolean
20 21 22 |
# File 'lib/cache-store-api/test_cache.rb', line 20 def exist?(key, = nil) data.has_key? key end |
#read(key, options = nil) ⇒ Object
12 13 14 |
# File 'lib/cache-store-api/test_cache.rb', line 12 def read(key, = nil) data[key] end |
#write(key, value, options = nil) ⇒ Object
8 9 10 |
# File 'lib/cache-store-api/test_cache.rb', line 8 def write(key, value, = nil) data[key] = value end |