php使用leveldb
leveldb是一个Google开发的速度飞快的数据库键值存储引擎,可按照字符串键值顺序映射,按照BSD许可开源LevelDB。
API http://leveldb.googlecode.com/svn/trunk/doc/index.html
2)php-leveldb
php-leveldbleveldb的PHP扩展,接口简单
$path = '/tmp/leveldb.log' ; $db = new LevelDb( $path ); echo "* setting (foo=bar): \n" ; var_dump( $db ->set( 'foo' , 'bar' )); echo "* getting (foo): \n" ; var_dump( $db ->get( 'foo' )); echo "* delete (foo): \n" ; var_dump( $db -> delete ( 'foo' )); echo "* getting (foo): \n" ; var_dump( $db ->get( 'foo' )); |
一键安装
#!/bin/sh #目录 BUILD= /home/venkman/data/server cd $BUILD #下载leveldb svn export http: //leveldb .googlecode.com /svn/trunk/ leveldb cd leveldb make cd $BUILD #php-leveldb git clone git: //github .com /arraypad/php-leveldb .git cd php-leveldb phpize . /configure --with-leveldb=$BUILD /leveldb --with-php-config= /home/venkman/data/server/php/bin/php-config make make install |
注意修改php.ini增加extension = leveldb.so并重启php