Parent

Files

Class/Module Index [+]

Quicksearch

Moneta::Adapters::KyotoCabinet

KyotoCabinet backend @api public

Public Class Methods

new(options = {}) click to toggle source

@param [Hash] options @option options [String] :file Database file @option options [::KyotoCabinet::DB] :backend Use existing backend instance

# File lib/moneta/adapters/kyotocabinet.rb, line 11
def initialize(options = {})
  if options[:backend]
    @backend = options[:backend]
  else
    raise ArgumentError, 'Option :file is required' unless options[:file]
    @backend = ::KyotoCabinet::DB.new
    raise @backend.error.to_s unless @backend.open(options[:file],
                                                   ::KyotoCabinet::DB::OWRITER | ::KyotoCabinet::DB::OCREATE)
  end
end

Public Instance Methods

close() click to toggle source

(see Proxy#close)

# File lib/moneta/adapters/kyotocabinet.rb, line 38
def close
  @backend.close
  nil
end
create(key, value, options = {}) click to toggle source

(see Proxy#create)

# File lib/moneta/adapters/kyotocabinet.rb, line 33
def create(key, value, options = {})
  @backend.add(key, value)
end
delete(key, options = {}) click to toggle source

(see Proxy#delete)

# File lib/moneta/adapters/kyotocabinet.rb, line 28
def delete(key, options = {})
  @backend.seize(key)
end
key?(key, options = {}) click to toggle source

(see Proxy#key?)

# File lib/moneta/adapters/kyotocabinet.rb, line 23
def key?(key, options = {})
  @backend.check(key) >= 0
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.