summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authortzik <tzik@google.com>2015-08-23 20:35:01 -0700
committerChris Mumford <cmumford@chromium.org>2015-12-09 10:34:58 -0800
commit359b6bcec28944972d0be503a78205b5cc574a9c (patch)
treecc4468e9a6c5ceb82025e15c5618bc1120a2b7d3 /include
parent50e77a8263b19033b99ba49cdc45995595f1acf9 (diff)
downloadleveldb-359b6bcec28944972d0be503a78205b5cc574a9c.tar.gz
Add leveldb::Cache::Prune
Prune() drops on-memory read cache of the database, so that the client can relief its memory shortage. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=101335710
Diffstat (limited to 'include')
-rw-r--r--include/leveldb/cache.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/leveldb/cache.h b/include/leveldb/cache.h
index 1a201e5..5f86cd0 100644
--- a/include/leveldb/cache.h
+++ b/include/leveldb/cache.h
@@ -81,6 +81,13 @@ class Cache {
// its cache keys.
virtual uint64_t NewId() = 0;
+ // Remove all cache entries that are not actively in use. Memory-constrained
+ // applications may wish to call this method to reduce memory usage.
+ // Default implementation of Prune() does nothing. Subclasses are strongly
+ // encouraged to override the default implementation. A future release of
+ // leveldb may change Prune() to a pure abstract method.
+ virtual void Prune() {}
+
private:
void LRU_Remove(Handle* e);
void LRU_Append(Handle* e);