NoSql数据库:LevelDB

风行水上 @ 2015-03-22 12:08:18
标签:

    Google出品。

    TODO

    #include "leveldb/include/db.h"
     
    leveldb::DB* db;
    leveldb::Options options;
    options.create_if_missing = true;
    leveldb::Status status = leveldb::DB::Open(options, "/tmp/testdb", &db);
    assert(status.ok());
     
    std::string value;
    leveldb::Status s = db->Get(leveldb::ReadOptions(), key1, &value);
    if (s.ok()) s = db->Put(leveldb::WriteOptions(), key2, value);
    if (s.ok()) s = db->Delete(leveldb::WriteOptions(), key1);
    
    标签:

      分享到:
      comments powered by Disqus

      39/41ms