Public Member Functions | |
void | flush () |
virtual | ~Cache () |
Protected Member Functions | |
Cache (CachePolicy policy) | |
void | _reloadIfNeeded () |
virtual void | _loadDataIntoCache ()=0 |
virtual void | _clearCachedData ()=0 |
Protected Attributes | |
CachePolicy | _policy |
bool | _cacheIsEmpty |
boost::mutex | _cacheMutex |
A base class to be used when implementing a cache of data. That is, a set of data that is not expected to change often, but which may need to be updated at some point (either through some automatic means or via user or application request).
|
inlinevirtual |
Definition at line 25 of file Cache.h.
References _clearCachedData(), _loadDataIntoCache(), _reloadIfNeeded(), and Cache().
|
explicitprotected |
Constructor.
policy | the CachePolicy to use for automatically expiring the cache. |
Definition at line 20 of file Cache.cpp.
Referenced by ~Cache().
|
protectedpure virtual |
Implemented in novadaq::EnvVarCache.
Referenced by _reloadIfNeeded(), flush(), and ~Cache().
|
protectedpure virtual |
Implemented in novadaq::EnvVarCache.
Referenced by _reloadIfNeeded(), and ~Cache().
|
protected |
Reloads the cache if needed.
Definition at line 25 of file Cache.cpp.
References _cacheIsEmpty, _clearCachedData(), _loadDataIntoCache(), _policy, novadaq::CachePolicy::cacheUpdated(), and novadaq::CachePolicy::isExpired().
Referenced by ~Cache().
void novadaq::Cache::flush | ( | ) |
Flushes the cache. (Removes any saved data.)
Definition at line 8 of file Cache.cpp.
References _cacheIsEmpty, _cacheMutex, and _clearCachedData().
Referenced by CacheTests::testEnvVarCacheBasic(), and CacheTests::testEnvVarCacheNumbers().
|
protected |
Definition at line 40 of file Cache.h.
Referenced by _reloadIfNeeded(), and flush().
|
protected |
Definition at line 41 of file Cache.h.
Referenced by flush(), novadaq::EnvVarCache::getEnvVar(), novadaq::EnvVarCache::getEnvVarAsDouble(), and novadaq::EnvVarCache::getEnvVarAsLong().
|
protected |
Definition at line 39 of file Cache.h.
Referenced by _reloadIfNeeded().