Class: Flipper::Adapters::CacheStore
- Inherits:
-
Object
- Object
- Flipper::Adapters::CacheStore
- Defined in:
- lib/flipper/adapters/cache_store.rb,
lib/flipper/adapters/cache_store/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Instance Method Summary collapse
- #delete(key) ⇒ Object
-
#initialize(cache_store) ⇒ CacheStore
constructor
A new instance of CacheStore.
- #read(key) ⇒ Object
- #set_add(key, value) ⇒ Object
- #set_delete(key, value) ⇒ Object
- #set_members(key) ⇒ Object
- #write(key, value) ⇒ Object
Constructor Details
#initialize(cache_store) ⇒ CacheStore
Returns a new instance of CacheStore.
4 5 6 |
# File 'lib/flipper/adapters/cache_store.rb', line 4 def initialize(cache_store) @cache_store = cache_store end |
Instance Method Details
#delete(key) ⇒ Object
16 17 18 |
# File 'lib/flipper/adapters/cache_store.rb', line 16 def delete(key) @cache_store.delete key.to_s end |
#read(key) ⇒ Object
8 9 10 |
# File 'lib/flipper/adapters/cache_store.rb', line 8 def read(key) @cache_store.read key.to_s end |
#set_add(key, value) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/flipper/adapters/cache_store.rb', line 20 def set_add(key, value) ensure_set_initialized(key) set = read(key) set.add value write(key, set) end |
#set_delete(key, value) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/flipper/adapters/cache_store.rb', line 27 def set_delete(key, value) ensure_set_initialized(key) set = read(key) set.delete value write(key, set) end |
#set_members(key) ⇒ Object
34 35 36 37 |
# File 'lib/flipper/adapters/cache_store.rb', line 34 def set_members(key) ensure_set_initialized(key) @cache_store.read key.to_s end |
#write(key, value) ⇒ Object
12 13 14 |
# File 'lib/flipper/adapters/cache_store.rb', line 12 def write(key, value) @cache_store.write key.to_s, value end |