Class: Moneta::Adapters::LocalMemCache
- Inherits:
-
Object
- Object
- Moneta::Adapters::LocalMemCache
- Includes:
- Defaults, HashAdapter
- Defined in:
- lib/moneta/adapters/localmemcache.rb
Overview
LocalMemCache backend
Instance Attribute Summary
Attributes included from HashAdapter
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, #create, #decrement, #features, #fetch, included, #increment, #key?, #supports?
Methods included from OptionSupport
#expires, #prefix, #raw, #with
Constructor Details
#initialize(options = {}) ⇒ LocalMemCache
Returns a new instance of LocalMemCache.
14 15 16 17 18 19 20 |
# File 'lib/moneta/adapters/localmemcache.rb', line 14 def initialize( = {}) @backend = [:backend] || begin raise ArgumentError, 'Option :file is required' unless [:file] ::LocalMemCache.new(:filename => [:file]) end end |
Instance Method Details
#delete(key, options = {}) ⇒ Object
Delete the key from the store and return the current value
23 24 25 26 27 |
# File 'lib/moneta/adapters/localmemcache.rb', line 23 def delete(key, = {}) value = load(key, ) @backend.delete(key) value end |