Class: Kvom::Storage::CacheWithPrefix
- Inherits:
-
Object
- Object
- Kvom::Storage::CacheWithPrefix
- Defined in:
- lib/kvom/storage/cache_with_prefix.rb
Instance Method Summary collapse
-
#initialize(cache, prefix) ⇒ CacheWithPrefix
constructor
A new instance of CacheWithPrefix.
- #read(id) ⇒ Object
- #write(id, value) ⇒ Object
Constructor Details
#initialize(cache, prefix) ⇒ CacheWithPrefix
Returns a new instance of CacheWithPrefix.
7 8 9 10 |
# File 'lib/kvom/storage/cache_with_prefix.rb', line 7 def initialize(cache, prefix) @prefix = prefix @cache = cache end |
Instance Method Details
#read(id) ⇒ Object
12 13 14 |
# File 'lib/kvom/storage/cache_with_prefix.rb', line 12 def read(id) cache.read(cache_id(id)) end |
#write(id, value) ⇒ Object
16 17 18 |
# File 'lib/kvom/storage/cache_with_prefix.rb', line 16 def write(id, value) cache.write(cache_id(id), value) end |