ROMAには何種類かクライアントがありますが、そのうちの一つのRuby Clientの使い方を簡単に紹介します
Ruby Client
準備
$ gem install roma-client
サンプル
require 'roma/client'
nodes = ["localhost_10001", "localhost_10002"]
rc = Roma::Client::RomaClient.new(nodes)
# set(key, val, expt = 0, raw = false)
rc.set('foo', 'bar') # STORED
# get(key, raw = false)
rc.get('foo') # bar
# delete(key)
rc.delete('foo') # DELETED
rc.get('foo') # nil
# stats(filter: "", node: @rttable.nodes.first)
rc.stats(filter: "nodes") # {"routing.nodes.length"=>"2", "routing.nodes"=>"[\"localhost_10001\", \"localhost_10002\"]", "routing.vnodes.length"=>"512", "routing.short_vnodes"=>"0", "routing.lost_vnodes"=>"0", "routing.version_of_nodes"=>"{\"localhost_10001\"=>66048, \"localhost_10002\"=>66048}"}
その他基本的な使い方は以下のPageにあります
https://github.com/roma/roma-ruby-client/blob/master/lib/roma/client/rclient.rb
https://github.com/roma/roma-ruby-client/tree/master/lib/roma/client/plugin
参照URL
ROMA ruby client: http://roma-kvs.org/docs/rubyclient.html