Class: Moneta::Adapters::SDBM

Inherits:
Memory
  • Object
show all
Defined in:
lib/moneta/adapters/sdbm.rb

Overview

SDBM backend

Instance Method Summary collapse

Methods included from IncrementSupport

#increment

Methods included from HashAdapter

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

Methods included from Defaults

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

Methods included from OptionSupport

#expires, #prefix, #raw, #with

Constructor Details

#initialize(options = {}) ⇒ SDBM

Returns a new instance of SDBM

Parameters:

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

Options Hash (options):

  • :file (String)

    Database file

Raises:

  • (ArgumentError)

10
11
12
13
# File 'lib/moneta/adapters/sdbm.rb', line 10

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

Instance Method Details

#closeObject

Explicitly close the store

Returns:

  • nil


16
17
18
19
# File 'lib/moneta/adapters/sdbm.rb', line 16

def close
  @hash.close
  nil
end