Class: Moneta::Adapters::DBM

Inherits:
Object
  • Object
show all
Includes:
CreateSupport, DBMAdapter, Defaults, EachKeySupport, IncrementSupport
Defined in:
lib/moneta/adapters/dbm.rb

Overview

DBM backend (Berkeley DB)

Instance Attribute Summary

Attributes included from HashAdapter

#backend

Instance Method Summary collapse

Methods included from EachKeySupport

#each_key, included

Methods included from CreateSupport

#create, included

Methods included from IncrementSupport

included, #increment

Methods included from DBMAdapter

#close, #merge!

Methods included from HashAdapter

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

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 = {}) ⇒ DBM

Returns a new instance of DBM.

Parameters:

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

Options Hash (options):

  • :file (String)

    Database file

  • :backend (::DBM)

    Use existing backend instance



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

def initialize(options = {})
  @backend = options[:backend] ||
    begin
      raise ArgumentError, 'Option :file is required' unless options[:file]
      ::DBM.new(options[:file])
    end
end