Home > Backend Development > PHP Tutorial > php使用leveldb

php使用leveldb

WBOY
Release: 2016-06-23 14:35:26
Original
1624 people have browsed it

1)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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template