Created
October 12, 2009 03:40
-
-
Save cchandler/208103 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 './cassandra' | |
require './cassandra_constants' | |
require './cassandra_types' | |
transport = Thrift::BufferedTransport.new(Thrift::Socket.new("127.0.0.1", "9160")) | |
transport.open | |
client = CassandraThrift::Cassandra::Client.new(Thrift::BinaryProtocol.new(transport)) | |
columnPath = CassandraThrift::ColumnPath.new(:column_family => "Places", :column => "test") | |
#For client-side managed timestamps | |
t = Time.now | |
time = t.to_i * 1_000_000 + t.usec | |
begin | |
client.insert("KeySpace","moo",columnPath, "test value for key 'moo' ", time,CassandraThrift::ConsistencyLevel::ONE) | |
p client.get("KeySpace","moo",columnPath,CassandraThrift::ConsistencyLevel::ONE) | |
rescue CassandraThrift::NotFoundException => e | |
p "No value" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment