Class: Moneta::Wrapper
Overview
Wraps the calls to the adapter
Direct Known Subclasses
Lock, Logger, OptionMerger, Pool, Shared
Instance Attribute Summary
Attributes inherited from Proxy
Instance Method Summary collapse
-
#clear(options = {}) ⇒ void
Clear all keys in this store.
-
#close ⇒ Object
Explicitly close the store.
-
#create(key, value, options = {}) ⇒ Boolean
Atomically sets a key to value if it’s not set.
-
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value.
- #features ⇒ Object
-
#increment(key, amount = 1, options = {}) ⇒ Object
Atomically increment integer value with key.
-
#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 Proxy
Methods included from Defaults
#[], #[]=, #decrement, #fetch, included, #supports?
Methods included from OptionSupport
#expires, #prefix, #raw, #with
Constructor Details
This class inherits a constructor from Moneta::Proxy
Instance Method Details
#clear(options = {}) ⇒ void
This method returns an undefined value.
Clear all keys in this store
36 37 38 |
# File 'lib/moneta/wrapper.rb', line 36 def clear( = {}) wrap(:clear, ) { super } end |
#close ⇒ Object
Explicitly close the store
41 42 43 |
# File 'lib/moneta/wrapper.rb', line 41 def close wrap(:close) { super } end |
#create(key, value, options = {}) ⇒ Boolean
Not every Moneta store implements this method, a NotImplementedError is raised if it is not supported.
Atomically sets a key to value if it’s not set.
31 32 33 |
# File 'lib/moneta/wrapper.rb', line 31 def create(key, value, = {}) wrap(:create, key, value, ) { super } end |
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value
21 22 23 |
# File 'lib/moneta/wrapper.rb', line 21 def delete(key, = {}) wrap(:delete, key, ) { super } end |
#features ⇒ Object
46 47 48 |
# File 'lib/moneta/wrapper.rb', line 46 def features wrap(:features) { super } end |
#increment(key, amount = 1, options = {}) ⇒ Object
Not every Moneta store implements this method, a NotImplementedError is raised if it is not supported.
Atomically increment integer value with key
This method also accepts negative amounts.
26 27 28 |
# File 'lib/moneta/wrapper.rb', line 26 def increment(key, amount = 1, = {}) wrap(:increment, key, amount, ) { super } end |
#key?(key, options = {}) ⇒ Boolean
Exists the value with key
6 7 8 |
# File 'lib/moneta/wrapper.rb', line 6 def key?(key, = {}) wrap(:key?, key, ) { super } end |
#load(key, options = {}) ⇒ Object
Fetch value with key. Return nil if the key doesn’t exist
11 12 13 |
# File 'lib/moneta/wrapper.rb', line 11 def load(key, = {}) wrap(:load, key, ) { super } end |
#store(key, value, options = {}) ⇒ Object
Store value with key
16 17 18 |
# File 'lib/moneta/wrapper.rb', line 16 def store(key, value, = {}) wrap(:store, key, value, ) { super } end |