Module: Moneta::HashAdapter Private
- Included in:
- Adapters::LocalMemCache, Adapters::Memory
- Defined in:
- lib/moneta/mixins.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#clear(options = {}) ⇒ void
Clear all keys in this store.
-
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value.
-
#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.
Instance Method Details
#clear(options = {}) ⇒ void
This method returns an undefined value.
Clear all keys in this store
181 182 183 184 |
# File 'lib/moneta/mixins.rb', line 181 def clear( = {}) @hash.clear self end |
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value
176 177 178 |
# File 'lib/moneta/mixins.rb', line 176 def delete(key, = {}) @hash.delete(key) end |
#key?(key, options = {}) ⇒ Boolean
Exists the value with key
161 162 163 |
# File 'lib/moneta/mixins.rb', line 161 def key?(key, = {}) @hash.has_key?(key) end |
#load(key, options = {}) ⇒ Object
Fetch value with key. Return nil if the key doesn’t exist
166 167 168 |
# File 'lib/moneta/mixins.rb', line 166 def load(key, = {}) @hash[key] end |
#store(key, value, options = {}) ⇒ Object
Store value with key
171 172 173 |
# File 'lib/moneta/mixins.rb', line 171 def store(key, value, = {}) @hash[key] = value end |