From daa25c26e99eb62a4ce499f8079b15734987ac0d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 30 Apr 2010 05:44:39 +0000 Subject: Many minor fixes to the caching system, membuf, and others, but mainly some important fixes for real-life use of the system. --- src/cache.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/cache.h') diff --git a/src/cache.h b/src/cache.h index 987443c..06b798c 100644 --- a/src/cache.h +++ b/src/cache.h @@ -205,6 +205,12 @@ namespace Bu virtual ~Cache() { TRACE(); + + // Better safe than sorry, better try a sync before anything + // else happens. + sync(); + + // Cycle through and unload all objects from the system. for( typename CidHash::iterator i = hEnt.begin(); i != hEnt.end(); i++ ) { @@ -214,10 +220,6 @@ namespace Bu // object when the Cache is destroyed. throw Bu::ExceptionBase("iRefs not zero."); } - pCalc->onUnload( - i.getValue().pData, - i.getKey() - ); pStore->unload( i.getValue().pData, i.getKey() @@ -230,6 +232,8 @@ namespace Bu Ptr insert( obtype *pData ) { TRACE( pData ); + if( pStore->has( __cacheGetKey( pData ) ) ) + throw Bu::ExceptionBase("Key already exists in cache."); CacheEntry e = {pData, 0, 0}; keytype k = pStore->create( pData ); hEnt.insert( k, e ); @@ -336,6 +340,11 @@ namespace Bu return pStore->getKeys(); } + KeyList getActiveKeys() + { + return hEnt.getKeys(); + } + int getSize() { return pStore->getSize(); -- cgit v1.2.3