Class: Juno::Proxy
Overview
Proxy base class
Direct Known Subclasses
Instance Attribute Summary collapse
- #adapter ⇒ Object readonly
Instance Method Summary collapse
-
#clear(options = {}) ⇒ void
Clear all keys in this store.
-
#close ⇒ Object
Close this store.
-
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value.
-
#initialize(adapter, options = {}) ⇒ Proxy
constructor
Constructor.
-
#key?(key, options = {}) ⇒ Boolean
Exists the value with key.
-
#load(key, options = {}) ⇒ Object
Fetch value with key.
-
#store(key, value, options = {}) ⇒ Object
Store value with key.
Methods inherited from Base
Constructor Details
#initialize(adapter, options = {}) ⇒ Proxy
Constructor
11 12 13 |
# File 'lib/juno/proxy.rb', line 11 def initialize(adapter, = {}) @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
5 6 7 |
# File 'lib/juno/proxy.rb', line 5 def adapter @adapter end |
Instance Method Details
#clear(options = {}) ⇒ void
This method returns an undefined value.
Clear all keys in this store
61 62 63 64 |
# File 'lib/juno/proxy.rb', line 61 def clear( = {}) @adapter.clear() self end |
#close ⇒ Object
Close this store
68 69 70 |
# File 'lib/juno/proxy.rb', line 68 def close @adapter.close end |
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value
52 53 54 |
# File 'lib/juno/proxy.rb', line 52 def delete(key, = {}) @adapter.delete(key, ) end |
#key?(key, options = {}) ⇒ Boolean
Exists the value with key
21 22 23 |
# File 'lib/juno/proxy.rb', line 21 def key?(key, = {}) @adapter.key?(key, ) end |
#load(key, options = {}) ⇒ Object
Fetch value with key. Return nil if the key doesn’t exist
31 32 33 |
# File 'lib/juno/proxy.rb', line 31 def load(key, = {}) @adapter.load(key, ) end |
#store(key, value, options = {}) ⇒ Object
Store value with key
42 43 44 |
# File 'lib/juno/proxy.rb', line 42 def store(key, value, = {}) @adapter.store(key, value, ) end |