Expose usage info for the cache

Summary: This diff will help us to figure out the memory usage for the cache part.

Test Plan: added a new memory usage test for cache

Reviewers: haobo, sdong, dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D14559
This commit is contained in:
kailiu
2013-12-10 16:21:49 -08:00
parent 9718c790ec
commit b660e2d468
3 changed files with 74 additions and 28 deletions

View File

@@ -104,6 +104,9 @@ class Cache {
// returns the maximum configured capacity of the cache
virtual size_t GetCapacity() const = 0;
// returns the memory size for the entries residing in the cache.
virtual size_t GetUsage() const = 0;
private:
void LRU_Remove(Handle* e);
void LRU_Append(Handle* e);