1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ROMAAdvent Calendar 2015

Day 19

ROMAのクライアントその1(ruby client)

Last updated at Posted at 2015-12-18

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

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?