Class: Juno::Adapters::LocalMemCache

Inherits:
Memory
  • Object
show all
Defined in:
lib/juno/adapters/localmemcache.rb

Overview

LocalMemCache backend

Instance Method Summary collapse

Methods inherited from Memory

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

Methods inherited from Base

#[], #[]=, #close, #fetch

Constructor Details

#initialize(options = {}) ⇒ LocalMemCache

Constructor

Options:

  • :file - Database file

Parameters:

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

Raises:

  • (ArgumentError)


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

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

Instance Method Details

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



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

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