Class: Moneta::Adapters::LMC
- Inherits:
-
Object
- Object
- Moneta::Adapters::LMC
- Includes:
- Defaults
- Defined in:
- lib/moneta/adapters/lmc.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #clear ⇒ Object
- #delete(key) ⇒ Object
-
#initialize(options = {}) ⇒ LMC
constructor
A new instance of LMC.
- #key?(key) ⇒ Boolean
- #store(key, value) ⇒ Object
Methods included from Defaults
Constructor Details
#initialize(options = {}) ⇒ LMC
Returns a new instance of LMC.
13 14 15 |
# File 'lib/moneta/adapters/lmc.rb', line 13 def initialize( = {}) @hash = LocalMemCache.new(:filename => [:filename]) end |
Instance Method Details
#[](key) ⇒ Object
17 18 19 |
# File 'lib/moneta/adapters/lmc.rb', line 17 def [](key) deserialize(@hash[key_for(key)]) end |
#clear ⇒ Object
25 26 27 |
# File 'lib/moneta/adapters/lmc.rb', line 25 def clear(*) @hash.clear end |
#delete(key) ⇒ Object
33 34 35 36 37 |
# File 'lib/moneta/adapters/lmc.rb', line 33 def delete(key, *) value = self[key] @hash.delete(key_for(key)) value end |
#key?(key) ⇒ Boolean
29 30 31 |
# File 'lib/moneta/adapters/lmc.rb', line 29 def key?(key, *) @hash.keys.include?(key_for(key)) end |
#store(key, value) ⇒ Object
21 22 23 |
# File 'lib/moneta/adapters/lmc.rb', line 21 def store(key, value, *) @hash[key_for(key)] = serialize(value) end |