Created
May 18, 2010 15:56
-
-
Save akishin/405153 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'cassandra' | |
include Cassandra::Constants | |
client = Cassandra.new('Keyspace1', '127.0.0.1:9160') | |
# SuperColumn として name を指定 | |
client.insert(:Super1, 'foo', { 'name' => {'first' => 'bar', 'last' => 'baz'} } ) | |
# SuperColumn はあってもなくても可 | |
client.insert(:Super1, 'foo', { 'age' => '99' } ) | |
# key だけを指定して取得 | |
p client.get(:Super1, 'foo') | |
# SuperColumn を指定して取得 | |
p client.get(:Super1, 'foo', 'name') | |
# SuperColumn を指定して get_columns 呼び出し | |
p client.get_columns(:Super1, 'foo', ['name']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment