// should we need to, we can access the low-level client directly
$version = $cassandra->getConnection()->getClient()->describe_version();
echo 'Version directly: <pre>'.print_r($version, true).'</pre><hr/>';
*/
// if implemented, use the wrapped methods as these are smarter - can retry etc
$version = $cassandra->getVersion();
echo 'Version through wrapper: <pre>' . print_r($version, true) . '</pre><hr/>';
// cluster is a pool of connections
$cluster = $cassandra->getCluster();
echo 'Cluster: <pre>' . print_r($cluster, true) . '</pre><hr/>';
// you can ask the cluster for a connection to a random seed server from pool
$connection = $cluster->getConnection();
echo 'Connection: <pre>' . print_r($connection, true) . '</pre><hr/>';
// access column family, using the singleton syntax
// there is shorter "cf" methid that is an alias to "columnFamily"
$userColumnFamily = Cassandra::getInstance()->columnFamily('user');
echo 'Column family "user": <pre>' . print_r($userColumnFamily, true) . '</pre><hr/>';
// lets insert some test data using the convinience method "set" of Cassandra
// the syntax is COLUMN_FAMILY_NAME.KEY_NAME
$cassandra->set('user.john', array('email' => '*****@*****.**', 'name' => 'John Smith', 'age' => 34));
// when inserting data, it's ok if key name contains ".", no need to escape them
$cassandra->set('user.jane.doe', array('email' => '*****@*****.**', 'name' => 'Jane Doe', 'age' => 24));
// longer way of inserting data, first getting the column family
$cassandra->cf('user')->set('chuck', array('email' => '*****@*****.**', 'name' => 'Chuck Norris', 'age' => 24), Cassandra::CONSISTENCY_QUORUM);
// lets fetch all the information about user john
$john = $cassandra->get('user.john');
echo 'User "john": <pre>' . print_r($john, true) . '</pre><hr/>';
// since the jane key "jane.doe" includes a ".", we have to escape it
$jane = $cassandra->get('user.' . Cassandra::escape('jane.doe'));
echo 'User "jane.doe": <pre>' . print_r($jane, true) . '</pre><hr/>';
// there is some syntatic sugar on the query of Cassandra::get() allowing you
 /**
  * @expectedException CassandraInvalidRequestException
  */
 public function testGetInstanceThrowsExceptionIfNameNotFound()
 {
     Cassandra::getInstance('foobar');
 }