Class CacheManager¶
Defined in File cache_manager.hpp
Nested Relationships¶
Nested Types¶
Class Documentation¶
-
class CacheManager¶
This class implements a cache manager useful for the cases when the number of times the cached objects will be accessed is known.
Public Types
-
using key_type = size_t¶
Public Functions
-
template<typename Iterable1 = container::map<size_t, size_t>>
inline explicit CacheManager(Iterable1 &&decaying) noexcept¶
-
void reset() noexcept¶
Resets all cached data.
-
ERPtr access(key_type key) noexcept¶
Access cached data.
- Parameters:
key – The that identifies the cached data.
- Returns:
ERPtr to EvalResult
-
ERPtr store(key_type key, ERPtr data) noexcept¶
- Parameters:
key – The key to identify the cached data.
data – The data to be cached.
- Returns:
Pointer to the stored data. Implictly accesses the stored data, hence, decays the lifetime if the key accesses a decaying cache entry. Passing
key
that was not present during construction of this CacheManager object, stores nothing, but still returns a valid pointer todata
.
-
bool exists(key_type key) const noexcept¶
Check if the key exists in the database: does not check if cache exists.
-
int life(key_type key) const noexcept¶
if the key exists in the database, return the current lifetime count of the cached data otherwise return -1
Public Static Functions
-
static CacheManager empty() noexcept¶
Get an empty cache manager.
Friends
- friend struct access_by
-
template<typename T>
struct access_by¶
-
using key_type = size_t¶