Class: Moneta::Adapters::LocalMemCache

Inherits:
Moneta::Adapter show all
Includes:
HashAdapter
Defined in:
lib/moneta/adapters/localmemcache.rb

Overview

LocalMemCache backend

Instance Attribute Summary

Attributes included from HashAdapter

#backend

Attributes inherited from Moneta::Adapter

#backend

Instance Method Summary collapse

Methods included from HashAdapter

#clear, #fetch_values, #key?, #load, #merge!, #slice, #store, #values_at

Methods inherited from Moneta::Adapter

backend, backend_block, backend_required?

Methods included from Config

#config, included

Methods included from Defaults

#[], #[]=, #close, #create, #decrement, #each_key, #features, #fetch, #fetch_values, included, #increment, #key?, #merge!, #slice, #supports?, #update, #values_at

Methods included from OptionSupport

#expires, #prefix, #raw, #with

Constructor Details

#initialize(options = {}) ⇒ Object

Parameters:

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

Options Hash (options):

  • :file (String)

    Database file

  • :backend (::LocalMemCache)

    Use existing backend instance



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

backend { |file:| ::LocalMemCache.new(filename: file) }

Instance Method Details

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

Delete the key from the store and return the current value

Parameters:

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

Options Hash (options):

  • :raw (Boolean)

    Raw access without value transformation (See Transformer)

  • :prefix (String)

    Prefix key (See Transformer)

  • Other (Object)

    options as defined by the adapters or middleware

Returns:

  • (Object)

    current value



17
18
19
20
21
# File 'lib/moneta/adapters/localmemcache.rb', line 17

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