Class: Moneta::Adapters::LocalMemCache
- Inherits:
-
Object
- Object
- Moneta::Adapters::LocalMemCache
- Includes:
- Defaults, HashAdapter
- Defined in:
- lib/moneta/adapters/localmemcache.rb
Overview
LocalMemCache backend
Instance Method Summary collapse
-
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value.
-
#initialize(options = {}) ⇒ LocalMemCache
constructor
A new instance of LocalMemCache.
Methods included from HashAdapter
Methods included from Defaults
#[], #[]=, #close, #decrement, #fetch, #increment, #key?
Methods included from OptionSupport
#expires, #prefix, #raw, #with
Constructor Details
#initialize(options = {}) ⇒ LocalMemCache
Returns a new instance of LocalMemCache.
13 14 15 16 |
# File 'lib/moneta/adapters/localmemcache.rb', line 13 def initialize( = {}) raise ArgumentError, 'Option :file is required' unless [:file] @hash = ::LocalMemCache.new(:filename => [:file]) end |
Instance Method Details
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value
19 20 21 22 23 |
# File 'lib/moneta/adapters/localmemcache.rb', line 19 def delete(key, = {}) value = load(key, ) @hash.delete(key) value end |