-
Notifications
You must be signed in to change notification settings - Fork 100
Elegant Cassandra PHP client with TimeUUID and SuperColumnFamily support (port of pycassa)
hoan/phpcassa
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Notes:
* Compatible with Cassandra 0.5.1 upwards (0.6.1)
* Direct port of pycassa
* Basic conversion of types (UUIDs to strings)
Examples:
* Including files:
<?php
// Copy all the files in this repository to your include directory.
$GLOBALS['THRIFT_ROOT'] = dirname(__FILE__) . '/include/thrift/';
require_once $GLOBALS['THRIFT_ROOT'].'/packages/cassandra/Cassandra.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'].'/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TFramedTransport.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';
include_once(dirname(__FILE__) . '/include/phpcassa.php');
include_once(dirname(__FILE__) . '/include/uuid.php');
?>
* Setting up nodes:
<?php
CassandraConn::add_node('192.168.1.1', 9160);
CassandraConn::add_node('192.168.1.2', 5000);
?>
* Create a column family object
<?php
$users = new CassandraCF('Keyspace1', 'Users'); // ColumnFamily
$super = new CassandraCF('Keyspace1', 'SuperColumn', true); // SuperColumnFamily
?>
* Inserting:
<?php
$users->insert('1', array('email' => '[email protected]', 'password' => 'test'));
?>
* Querying:
<?php
$users->get('1'); // array('email' => '[email protected]', 'password' => 'test')
$users->multiget(array('1', '2')); // array('1' => array('email' => '[email protected]', 'password' => 'test'))
?>
* Removing:
<?php
$users->remove('1'); // removes whole object
$users->remove('1', 'password'); // removes 'password' field
?>
* Other:
<?php
$users->get_count('1'); // counts the number of columns in user 1 (in this case 2)
$users->get_range('1', '10'); // gets all users between '1' and '10'
?>
Email [email protected] with any questions. We also have a google group to ask questions:
http://groups.google.com/group/phpcassa
AUTHORS:
* Hoan Ton-That ([email protected])
* Benjamin Sussman ([email protected])
* Anthony ROUX ([email protected])
* Vadim Derkach
* Zach Buller ([email protected])
* Timandes
* Todd Zusman
* Yancho Georgiev ([email protected])
* Pieter Maes ([email protected])
About
Elegant Cassandra PHP client with TimeUUID and SuperColumnFamily support (port of pycassa)
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published