Class: Moneta::Adapters::LocalMemCache

Inherits:
Base
  • Object
show all
Includes:
Mixins::HashAdapter
Defined in:
lib/moneta/adapters/localmemcache.rb

Overview

LocalMemCache backend

Instance Method Summary collapse

Methods included from Mixins::HashAdapter

#clear, #key?, #load, #store

Methods inherited from Base

#[], #[]=, #close, #decrement, #fetch, #increment, #key?

Methods included from Mixins::WithOptions

#expires, #prefix, #raw, #with

Constructor Details

#initialize(options = {}) ⇒ LocalMemCache

Constructor

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :file (String)

    Database file

Raises:

  • (ArgumentError)


14
15
16
17
# File 'lib/moneta/adapters/localmemcache.rb', line 14

def initialize(options = {})
  raise ArgumentError, 'Option :file is required' unless options[:file]
  @hash = ::LocalMemCache.new(:filename => options[:file])
end

Instance Method Details

#delete(key, options = {}) ⇒ Object



19
20
21
22
23
# File 'lib/moneta/adapters/localmemcache.rb', line 19

def delete(key, options = {})
  value = load(key, options)
  @hash.delete(key)
  value
end