summaryrefslogtreecommitdiff
path: root/src/unstable/myriadcache.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2014-01-22 16:28:46 +0000
committerMike Buland <eichlan@xagasoft.com>2014-01-22 16:28:46 +0000
commit86e37bec7b2101555635201f83352c0e054f1849 (patch)
tree4d2a3652689ac7b615db82bdab520c2ed42dd705 /src/unstable/myriadcache.h
parent44a228640c782e46baf528749b5776714749ef2d (diff)
downloadlibbu++-86e37bec7b2101555635201f83352c0e054f1849.tar.gz
libbu++-86e37bec7b2101555635201f83352c0e054f1849.tar.bz2
libbu++-86e37bec7b2101555635201f83352c0e054f1849.tar.xz
libbu++-86e37bec7b2101555635201f83352c0e054f1849.zip
Updated the cache system. It now ensures that objects are initialized with
cache information before they are deserialized from storage. This changed the signature of the cache loading template function, but the new function isn't harder to use, and provides the key information as well.
Diffstat (limited to '')
-rw-r--r--src/unstable/myriadcache.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/unstable/myriadcache.h b/src/unstable/myriadcache.h
index 9bc926f..d19395a 100644
--- a/src/unstable/myriadcache.h
+++ b/src/unstable/myriadcache.h
@@ -54,6 +54,7 @@ namespace Bu
54 } 54 }
55 55
56 using typename Bu::CacheBase<keytype,obtype>::KeyList; 56 using typename Bu::CacheBase<keytype,obtype>::KeyList;
57 using typename Bu::CacheBase<keytype,obtype>::ObjectType;
57 58
58 virtual typename Bu::CacheBase<keytype,obtype>::KeyList getKeys() const 59 virtual typename Bu::CacheBase<keytype,obtype>::KeyList getKeys() const
59 { 60 {
@@ -92,10 +93,13 @@ namespace Bu
92 bStructureChanged = true; 93 bStructureChanged = true;
93 } 94 }
94 95
95 virtual obtype *_load( const keytype &k ) 96 virtual obtype *_load(
97 typename Bu::CacheObject<keytype, obtype>::Initializer &initObj,
98 const keytype &k
99 )
96 { 100 {
97 Bu::MyriadStream ms = mStore.openStream( hIndex.get( k ) ); 101 Bu::MyriadStream ms = mStore.openStream( hIndex.get( k ) );
98 return _cacheObjectLoad<obtype>( ms ); 102 return _cacheObjectLoad<keytype, obtype>( initObj, k, ms );
99 } 103 }
100 104
101 virtual void _save( const obtype *o ) 105 virtual void _save( const obtype *o )