Database Reference
In-Depth Information
StringExtractor se = StringExtractor.get();
// insert value
Mutator m = HFactory.createMutator(keyspaceOperator);
m.insert("key1", "ColumnFamily1", createColumn("column1", "value1", se, se));
// Now read a value
// Create a query
ColumnQuery<String, String> q = HFactory.createColumnQuery(keyspaceOperator, se, se);
// set key, name, cf and execute
Result<HColumn<String, String>> r = q.setKey("key1").
setName("column1").
setColumnFamily("ColumnFamily1").
execute();
// read value from the result
HColumn<String, String> c = r.get();
String value = c.getValue();
System.out.println(value);
HectorSharp (C#)
HectorSharp is a C# port of Ran Tavory's Hector Java client (Tavory is also a committer on the
HectorSharp project). Its features are similar to Hector:
▪ A high-level client with an intuitive, object-oriented interface
▪ Client-side failover
▪ Connection pooling
▪ Load balancing
Let's walk through creating an application using HectorSharp as our interface to Cassandra. This
is probably the best way to see how to incorporate it into your projects. We'll create a simple C#
console project that reads and writes some data to Cassandra so you can see how it's used.
NOTE
As of this writing, HectorSharp works with version 0.6 of Cassandra, but not 0.7.
Using Git, download HectorSharp from http://github.com/mattvv/hectorsharp . Remember, to
easily get source code from Git, open a terminal in the directory you want as the parent, and use
the git clone command with the .gitURL, like this:
>git clone http://github.com/mattvv/hectorsharp.git
Search WWH ::




Custom Search