From fcaaf2927914cfda505051693f5717b4a56ec04a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 28 May 2009 19:58:08 +0000 Subject: The cache can now efficiently report how many items are stored in it, but there's no way to find out how many are in memory now, I may add something for that later, but it seems more or less unimportant (except maybe for fine-tuning and making interesting looking displays). --- src/cache.h | 5 +++++ src/cachestore.h | 1 + src/cachestorenids.h | 5 +++++ 3 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/cache.h b/src/cache.h index c4e1b0b..0cb2fd2 100644 --- a/src/cache.h +++ b/src/cache.h @@ -295,6 +295,11 @@ namespace Bu return pStore->getKeys(); } + int getSize() + { + return pStore->getSize(); + } + /** * Make sure all currently loaded but not-in-use objects are synced to * the store. diff --git a/src/cachestore.h b/src/cachestore.h index 437b3d3..b75864b 100644 --- a/src/cachestore.h +++ b/src/cachestore.h @@ -29,6 +29,7 @@ namespace Bu virtual void destroy( obtype *pObj, const keytype &key )=0; virtual bool has( const keytype &key )=0; virtual Bu::List getKeys() { return Bu::List(); } + virtual int getSize() { return -1; } private: }; diff --git a/src/cachestorenids.h b/src/cachestorenids.h index 0f7c72c..6a1c31b 100644 --- a/src/cachestorenids.h +++ b/src/cachestorenids.h @@ -131,6 +131,11 @@ namespace Bu return hId.getKeys(); } + virtual int getSize() + { + return hId.getSize(); + } + private: Nids nStore; typedef Bu::Hash NidHash; -- cgit v1.2.3