jsyoo / phpcassa
PHP Cassandra 库
v1.2.0
2016-10-27 14:47 UTC
Requires
- php: >=5.3.0
Suggests
- ext-thrift_protocol: Enabling the thrift protocol extension is crucial for phpcassa's performance
This package is not auto-updated.
Last update: 2024-09-28 19:42:05 UTC
README
phpcassa 是 Apache Cassandra 的 PHP 客户端库。
- 兼容 Cassandra 0.7 至 1.2
- 可选的 C 扩展,以提升性能
phpcassa 兼容 PHP 5.3+
phpcassa 在 MIT 许可证下开源。
已弃用
目前,phpcassa 已被弃用,将不再提供支持。
我建议使用位于此处的 DataStax PHP 驱动程序:[https://github.com/datastax/php-driver](https://github.com/datastax/php-driver)。它支持 CQL,具有许多优秀功能,且维护良好。
文档
虽然这个 README 包含一些有用的信息,但官方和更详细的文档可以在这里找到
http://thobbs.github.com/phpcassa
示例
你可以在 examples/
目录中找到一些完全可工作的示例脚本。
打开连接
$pool = new ConnectionPool('Keyspace1');
或
$pool = new ConnectionPool('Keyspace1', array('localhost'));
创建一个列族对象
$users = new ColumnFamily($pool, 'Standard1'); $super = new SuperColumnFamily($pool, 'Super1');
插入
$users->insert('key', array('column1' => 'value1', 'column2' => 'value2'));
查询
$users->get('key'); $users->multiget(array('key1', 'key2'));
删除
$users->remove('key1'); // removes whole row $users->remove('key1', 'column1'); // removes 'column1'
其他
$users->get_count('key1'); // counts the number of columns in row 'key1' $users->get_range('key1', 'key9'); // gets all rows with keys between '1' and '9'
使用 C 扩展
C 扩展对 phpcassa 的性能至关重要。
你需要配置并编译才能使用 C 扩展。
注意:如果 checkinstall
可用,请用 sudo checkinstall
替代 sudo make install
。
cd ext/thrift_protocol
phpize
./configure
make
sudo make install
将以下行添加到您的 php.ini 文件中
extension=thrift_protocol.so
获取帮助
- 邮件列表:[phpcassa on google groups](http://groups.google.com/group/phpcassa)
- IRC:irc.freenode.net 上的 #cassandra 频道