From 359b6bcec28944972d0be503a78205b5cc574a9c Mon Sep 17 00:00:00 2001 From: tzik Date: Sun, 23 Aug 2015 20:35:01 -0700 Subject: 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 --- include/leveldb/cache.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') 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); -- cgit v1.2.1