Corrected typo in docs: "cache" to "block_cache".
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=197452015
This commit is contained in:
parent
1868398150
commit
6a6bdafcf1
@ -338,19 +338,19 @@ options.compression = leveldb::kNoCompression;
|
|||||||
### Cache
|
### Cache
|
||||||
|
|
||||||
The contents of the database are stored in a set of files in the filesystem and
|
The contents of the database are stored in a set of files in the filesystem and
|
||||||
each file stores a sequence of compressed blocks. If options.cache is non-NULL,
|
each file stores a sequence of compressed blocks. If options.block_cache is
|
||||||
it is used to cache frequently used uncompressed block contents.
|
non-NULL, it is used to cache frequently used uncompressed block contents.
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
#include "leveldb/cache.h"
|
#include "leveldb/cache.h"
|
||||||
|
|
||||||
leveldb::Options options;
|
leveldb::Options options;
|
||||||
options.cache = leveldb::NewLRUCache(100 * 1048576); // 100MB cache
|
options.block_cache = leveldb::NewLRUCache(100 * 1048576); // 100MB cache
|
||||||
leveldb::DB* db;
|
leveldb::DB* db;
|
||||||
leveldb::DB::Open(options, name, &db);
|
leveldb::DB::Open(options, name, &db);
|
||||||
... use the db ...
|
... use the db ...
|
||||||
delete db
|
delete db
|
||||||
delete options.cache;
|
delete options.block_cache;
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that the cache holds uncompressed data, and therefore it should be sized
|
Note that the cache holds uncompressed data, and therefore it should be sized
|
||||||
|
Loading…
Reference in New Issue
Block a user