Class: Juno::Adapters::LevelDB
- Defined in:
- lib/juno/adapters/leveldb.rb
Overview
LevelDB backend
Instance Method Summary collapse
- #clear(options = {}) ⇒ Object
- #close ⇒ Object
-
#initialize(options = {}) ⇒ LevelDB
constructor
Constructor.
- #key?(key, options = {}) ⇒ Boolean
Methods inherited from Memory
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ LevelDB
Constructor
Options:
-
:dir - Database path
-
All other options passed to LevelDB::DB#new
15 16 17 18 |
# File 'lib/juno/adapters/leveldb.rb', line 15 def initialize( = {}) raise ArgumentError, 'Option :dir is required' unless [:dir] @memory = ::LevelDB::DB.new([:dir]) end |
Instance Method Details
#clear(options = {}) ⇒ Object
24 25 26 27 |
# File 'lib/juno/adapters/leveldb.rb', line 24 def clear( = {}) @memory.each {|k,v| delete(k, ) } self end |
#close ⇒ Object
29 30 31 32 |
# File 'lib/juno/adapters/leveldb.rb', line 29 def close @memory.close nil end |
#key?(key, options = {}) ⇒ Boolean
20 21 22 |
# File 'lib/juno/adapters/leveldb.rb', line 20 def key?(key, = {}) @memory.includes?(key) end |