The rocksdb is a persistent in-process key-value store.
Read more about it here: http://rocksdb.org/
This gem contains Ruby bindings so that you can use it from your Ruby process.
First install rocksdb.
Add this line to your application's Gemfile:
gem 'rocksdb-ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rocksdb-ruby
require "rocksdb"
# Reads And Writes
key = "test"
value = "1"
rocksdb = RocksDB::DB.new "/tmp/file"
rocksdb.put(key, value)
new_value = rocksdb.get(key)
rocksdb.delete(key)
#Atomic Updates
batch = RocksDB::Batch.new
batch.delete("test:batch1")
batch.put("test:batch2", "b")
rocksdb.write(batch)
#Iteration
iterator = rocksdb.new_iterator
iterator.seek_to_first
while(iterator.valid)
iterator.value
iterator.key
iterator.next
end
iterator.close
#Block
rocksdb.each do |data|
puts data
end
#Hash access
rocksdb['key'] = data
puts rocksdb['key']
rocksdb.close
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request