LevelDB

LevelDB
開發者Google
首次发布2012年5月,​13年前​(2012-05
当前版本1.23[1]在维基数据编辑(2021年2月23日,4年前)
源代码库 編輯維基數據鏈接
编程语言C++
操作系统跨平台
类型嵌入數據庫編程庫
许可协议BSD许可证
网站github.com/google/leveldb 编辑维基数据

LevelDB是一個由Google公司所研發的键-值存储嵌入式數據庫管理系統編程庫,[2]開源BSD許可證發佈。[3]

特徵

[编辑]

例子

[编辑]

儲存鍵/值對,和查詢鍵的值:

#include "leveldb/db.h" #include <iostream>  using namespace std;  int main(){   leveldb::DB *db;   leveldb::Options options;    options.create_if_missing = true;    // 開啟數據庫   leveldb::DB::Open(options, "/tmp/testdb", &db);    // 鍵 = MyKey29,值 = "Hello World!"   string key = "MyKey29", value = "Hello World!", result;    // 儲存 鍵/值對   db->Put(leveldb::WriteOptions(), key, value);    // 查詢 MyKey29 鍵的值   db->Get(leveldb::ReadOptions(), key, &result);    // 輸出值到屏幕   cout << "result = " << result << endl;    // 關閉數據庫   delete db;    return 0; } 

執行結果

[编辑]

(LevelDB安裝目錄為:leveldb-read-only)[6]

% g++ test.cc -Ileveldb-read-only/include -Lleveldb-read-only -lleveldb -lpthread % ./a.out  result = Hello World! 

RocksDB

[编辑]

2013年Facebook基於LevelDB開發出RocksDB,特別針對伺服器負載而優化。[7]

语言的绑定

[编辑]

參見

[编辑]

参考文献

[编辑]
  1. ^ 1.0 1.1 Release 1.23. 2021年2月23日 [2021年3月13日]. 
  2. ^ leveldb實現解析 (PDF). [2017-09-05]. (原始内容存档 (PDF)于2012-01-31). 
  3. ^ LevelDB: A Fast Persistent Key-Value Store. [2011-08-07]. (原始内容存档于2016-03-26). 
  4. ^ LevelDB Benchmarks. [2011-08-07]. (原始内容存档于2011-08-20). 
  5. ^ A fast compressor/decompressor. [2011-07-30]. (原始内容存档于2015-08-22). 
  6. ^ Source Checkout - LevelDB. [2011-08-06]. (原始内容存档于2015-03-18). 
  7. ^ RocksDB. [2014-01-25]. (原始内容存档于2021-02-05). 

外部連結

[编辑]