aboutsummaryrefslogtreecommitdiff
path: root/src/cache.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cache.h17
1 files changed, 13 insertions, 4 deletions
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
205 virtual ~Cache() 205 virtual ~Cache()
206 { 206 {
207 TRACE(); 207 TRACE();
208
209 // Better safe than sorry, better try a sync before anything
210 // else happens.
211 sync();
212
213 // Cycle through and unload all objects from the system.
208 for( typename CidHash::iterator i = hEnt.begin(); 214 for( typename CidHash::iterator i = hEnt.begin();
209 i != hEnt.end(); i++ ) 215 i != hEnt.end(); i++ )
210 { 216 {
@@ -214,10 +220,6 @@ namespace Bu
214 // object when the Cache is destroyed. 220 // object when the Cache is destroyed.
215 throw Bu::ExceptionBase("iRefs not zero."); 221 throw Bu::ExceptionBase("iRefs not zero.");
216 } 222 }
217 pCalc->onUnload(
218 i.getValue().pData,
219 i.getKey()
220 );
221 pStore->unload( 223 pStore->unload(
222 i.getValue().pData, 224 i.getValue().pData,
223 i.getKey() 225 i.getKey()
@@ -230,6 +232,8 @@ namespace Bu
230 Ptr insert( obtype *pData ) 232 Ptr insert( obtype *pData )
231 { 233 {
232 TRACE( pData ); 234 TRACE( pData );
235 if( pStore->has( __cacheGetKey<keytype, obtype>( pData ) ) )
236 throw Bu::ExceptionBase("Key already exists in cache.");
233 CacheEntry e = {pData, 0, 0}; 237 CacheEntry e = {pData, 0, 0};
234 keytype k = pStore->create( pData ); 238 keytype k = pStore->create( pData );
235 hEnt.insert( k, e ); 239 hEnt.insert( k, e );
@@ -336,6 +340,11 @@ namespace Bu
336 return pStore->getKeys(); 340 return pStore->getKeys();
337 } 341 }
338 342
343 KeyList getActiveKeys()
344 {
345 return hEnt.getKeys();
346 }
347
339 int getSize() 348 int getSize()
340 { 349 {
341 return pStore->getSize(); 350 return pStore->getSize();