diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-05-28 19:58:08 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-05-28 19:58:08 +0000 |
commit | fcaaf2927914cfda505051693f5717b4a56ec04a (patch) | |
tree | e9769c4e1f420267c5d4903bbff26ca53a6f2934 /src | |
parent | 22914644fb62bc1a9d49eec50a10f2870dde1d0b (diff) | |
download | libbu++-fcaaf2927914cfda505051693f5717b4a56ec04a.tar.gz libbu++-fcaaf2927914cfda505051693f5717b4a56ec04a.tar.bz2 libbu++-fcaaf2927914cfda505051693f5717b4a56ec04a.tar.xz libbu++-fcaaf2927914cfda505051693f5717b4a56ec04a.zip |
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).
Diffstat (limited to '')
-rw-r--r-- | src/cache.h | 5 | ||||
-rw-r--r-- | src/cachestore.h | 1 | ||||
-rw-r--r-- | src/cachestorenids.h | 5 |
3 files changed, 11 insertions, 0 deletions
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 | |||
295 | return pStore->getKeys(); | 295 | return pStore->getKeys(); |
296 | } | 296 | } |
297 | 297 | ||
298 | int getSize() | ||
299 | { | ||
300 | return pStore->getSize(); | ||
301 | } | ||
302 | |||
298 | /** | 303 | /** |
299 | * Make sure all currently loaded but not-in-use objects are synced to | 304 | * Make sure all currently loaded but not-in-use objects are synced to |
300 | * the store. | 305 | * 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 | |||
29 | virtual void destroy( obtype *pObj, const keytype &key )=0; | 29 | virtual void destroy( obtype *pObj, const keytype &key )=0; |
30 | virtual bool has( const keytype &key )=0; | 30 | virtual bool has( const keytype &key )=0; |
31 | virtual Bu::List<keytype> getKeys() { return Bu::List<keytype>(); } | 31 | virtual Bu::List<keytype> getKeys() { return Bu::List<keytype>(); } |
32 | virtual int getSize() { return -1; } | ||
32 | 33 | ||
33 | private: | 34 | private: |
34 | }; | 35 | }; |
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 | |||
131 | return hId.getKeys(); | 131 | return hId.getKeys(); |
132 | } | 132 | } |
133 | 133 | ||
134 | virtual int getSize() | ||
135 | { | ||
136 | return hId.getSize(); | ||
137 | } | ||
138 | |||
134 | private: | 139 | private: |
135 | Nids nStore; | 140 | Nids nStore; |
136 | typedef Bu::Hash<keytype, long> NidHash; | 141 | typedef Bu::Hash<keytype, long> NidHash; |