Class: Moneta::Adapters::SDBM

Inherits:
SDBM
  • Object
show all
Includes:
Defaults
Defined in:
lib/moneta/adapters/sdbm.rb

Instance Method Summary collapse

Methods included from Defaults

#[]=, #fetch

Constructor Details

#initialize(options = {}) ⇒ SDBM

Returns a new instance of SDBM.



8
9
10
11
# File 'lib/moneta/adapters/sdbm.rb', line 8

def initialize(options = {})
  raise "No :file options specified" unless file = options[:file]
  super(file)
end

Instance Method Details

#[](key) ⇒ Object



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

def [](key)
  if val = super(key_for(key))
    deserialize(val)
  end
end

#delete(key) ⇒ Object



27
28
29
30
31
# File 'lib/moneta/adapters/sdbm.rb', line 27

def delete(key, *)
  if val = super(key_for(key))
    deserialize(val)
  end
end

#key?(key) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/moneta/adapters/sdbm.rb', line 23

def key?(key, *)
  super(key_for(key))
end

#store(key, value) ⇒ Object



19
20
21
# File 'lib/moneta/adapters/sdbm.rb', line 19

def store(key, value, *)
  super(key_for(key), serialize(value))
end