Module: Adapter::LevelDB
- Defined in:
- lib/adapter/leveldb.rb,
lib/adapter/leveldb/version.rb
Constant Summary collapse
- VERSION =
'0.1.0'
Instance Method Summary collapse
Instance Method Details
#clear ⇒ Object
18 19 20 |
# File 'lib/adapter/leveldb.rb', line 18 def clear client.each { |key, value| client.delete(key) } end |
#delete(key) ⇒ Object
14 15 16 |
# File 'lib/adapter/leveldb.rb', line 14 def delete(key) read(key).tap { client.delete(key_for(key)) } end |
#read(key) ⇒ Object
6 7 8 |
# File 'lib/adapter/leveldb.rb', line 6 def read(key) decode client[key_for(key)] end |
#write(key, value) ⇒ Object
10 11 12 |
# File 'lib/adapter/leveldb.rb', line 10 def write(key, value) client[key_for(key)] = encode(value) end |