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

Quick Facts 開發者, 首次發佈 ...
LevelDB
開發者Google
首次發佈2012年5月,​12年前​(2012-05
當前版本1.23[1]在維基數據編輯(2021年2月23日,3年前)
原始碼庫 編輯維基數據鏈接
程式語言C++
作業系統跨平台
類型嵌入數據庫編程庫
許可協議BSD許可證
網站github.com/google/leveldb 編輯維基數據
Close

特徵

例子

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

#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]

語言的綁定

參見

參考文獻

外部連結

Wikiwand in your browser!

Seamless Wikipedia browsing. On steroids.

Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.

Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.