LevelDB的Python封装包- py-leveldb

openkk 13年前
     py-leveldb 对 LevelDB API 进行了一个线程安全的 Python 封装。基本上覆盖了所有API除了:任意键比较,快照 和向后迭代。    <br />    <br /> 项目地址:    <a href="/misc/goto?guid=4958184534906235124" target="_blank">http://code.google.com/p/py-leveldb/</a>    <br />    <br />    <p><a href="/misc/goto?guid=4958183634494907073" target="_blank">Leveldb</a>是一个google实现的非常高效的kv数据库,目前的版本1.2能够支持billion级别的数据量了。 在这个数量级别下还有着非常高的性能,主要归功于它的良好的设计。特别是LSM算法。</p>    <p>LevelDB 是单进程的服务,性能非常之高,在一台4个Q6600的CPU机器上,每秒钟写数据超过40w,而随机读的性能每秒钟超过10w。</p> 项目主页:    <a href="/misc/goto?guid=4958183634494907073" target="_blank">http://code.google.com/p/leveldb/<br /> </a>    <br /> 示例代码:    <br />    <pre class="brush:python; toolbar: true; auto-links: false;">import leveldb    db = leveldb.LevelDB('./db')    # single put  db.Put('hello', 'world')  print db.Get('hello')    # single delete  db.Delete('hello')  print db.Get('hello')    # multiple put/delete applied atomically, and committed to disk  batch = leveldb.WriteBatch()  batch.Put('hello', 'world')  batch.Put('hello again', 'world')  batch.Delete('hello')    db.Write(batch, sync = True)</pre>    <br />