diff options
author | Mike Buland <eichlan@xagasoft.com> | 2013-03-18 15:31:39 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2013-03-18 15:31:39 +0000 |
commit | 92a6325b02d2a41d7c36993f7b230302f672a4ba (patch) | |
tree | 284589448762ec002adc8ee3127342acd1bd409d /src/unstable/cachebase.h | |
parent | 1db266b863a805d49928d831a690c39df640dc28 (diff) | |
download | libbu++-92a6325b02d2a41d7c36993f7b230302f672a4ba.tar.gz libbu++-92a6325b02d2a41d7c36993f7b230302f672a4ba.tar.bz2 libbu++-92a6325b02d2a41d7c36993f7b230302f672a4ba.tar.xz libbu++-92a6325b02d2a41d7c36993f7b230302f672a4ba.zip |
Added the has function to the new cache system. If the object identified by
key is loaded then the query doesn't even get to the superclass.
Diffstat (limited to 'src/unstable/cachebase.h')
-rw-r--r-- | src/unstable/cachebase.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/unstable/cachebase.h b/src/unstable/cachebase.h index 807adf0..026e69b 100644 --- a/src/unstable/cachebase.h +++ b/src/unstable/cachebase.h | |||
@@ -350,6 +350,16 @@ namespace Bu | |||
350 | ); | 350 | ); |
351 | } | 351 | } |
352 | 352 | ||
353 | bool has( const keytype &key ) | ||
354 | { | ||
355 | Bu::ReadWriteMutex::ReadLocker rl( mCacheEntry ); | ||
356 | |||
357 | if( hCacheEntry.has( key ) ) | ||
358 | return true; | ||
359 | |||
360 | return _has( key ); | ||
361 | } | ||
362 | |||
353 | CachePtr<keytype, obtype> get( const keytype &key ) | 363 | CachePtr<keytype, obtype> get( const keytype &key ) |
354 | { | 364 | { |
355 | Entry *pEnt = getEntry( key ); | 365 | Entry *pEnt = getEntry( key ); |
@@ -431,6 +441,7 @@ namespace Bu | |||
431 | } | 441 | } |
432 | 442 | ||
433 | protected: | 443 | protected: |
444 | virtual bool _has( const keytype &key )=0; | ||
434 | virtual void _create( const obtype *o )=0; | 445 | virtual void _create( const obtype *o )=0; |
435 | virtual void _erase( const keytype &k )=0; | 446 | virtual void _erase( const keytype &k )=0; |
436 | 447 | ||