diff options
Diffstat (limited to 'include/leveldb/cache.h')
-rw-r--r-- | include/leveldb/cache.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/leveldb/cache.h b/include/leveldb/cache.h index 1a201e5e0a..6819d5bc49 100644 --- a/include/leveldb/cache.h +++ b/include/leveldb/cache.h @@ -81,6 +81,17 @@ 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() {} + + // Return an estimate of the combined charges of all elements stored in the + // cache. + virtual size_t TotalCharge() const = 0; + private: void LRU_Remove(Handle* e); void LRU_Append(Handle* e); |