rkv - Ruby Key Value - an adapter on top of various key-value and column stores
The API is a nested (multidimensional) Hash. This allows effective mapping to both column stores and flat KV stores.
For example, if the Cassandra adapter is used, the first dimension is the column family, the second is the row within the CF and the third is the column within the row.
For flat KV stores, a key hierarchy is used for efficient mapping.
Installing the gem:
gem install rkv
require 'rubygems' require 'rkv' store = Rkv.open(:cassandra, { :servers => ['127.0.0.1:9160'], :keyspace => "Blog" }) # store = Rkv.open(:memory, :recurse => {"Users" => "*"}) # store = Rkv.open(:tokyocabinet, :file => "test.tcb", :recurse => {"Users" => "*"}) users = store["Users"] user = users["5"] user["name"] = "Dev Random" user["role"] = "admin" puts users["3"].inspect users.batch do users[id1]["name"] = "John Doe" users[id2]["name"] = "Jane Doe" end user_rels = client[:UserRelationships] user_rels[id1]["posts"][Cassandra::UUID.new] = post_id1
Keystores have different features. Operations are mapped to the best of the keystore ability, but some operations may be less efficient or impossible in certain keystores.
RDoc: rdoc.info/projects/devrandom/rkv
See spec/integration/stores_spec.rb for an example program that runs identically on all stores.
Git:
-
Cassandra
-
Memory
-
TokyoCabinet
-
Voldemort
-
Redis
-
Keyspace
-
SQL
-
Store support
-
Performance testing
-
Keystore feature support matrix
-
Object mapper?