template<typename T, typename U, typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
class cache::LruMap< T, U, Hash, Equal >
LRU key value storage (LRU cache), thread safety matches Standard Library thread safety
Definition at line 19 of file lru_map.hpp.
template<typename T , typename U , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
template<typename... Args>
U * cache::LruMap< T, U, Hash, Equal >::Emplace |
( |
const T & | key, |
|
|
Args &&... | args ) |
|
inline |
Returns pointer to value if the key is in LRU and updates its usage; constructs and adds a new key/value otherwise.
- Warning
- Returned pointer may be freed on the next map access!
Definition at line 38 of file lru_map.hpp.
template<typename T , typename U , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
void cache::LruMap< T, U, Hash, Equal >::SetMaxSize |
( |
size_t | new_max_size | ) |
|
|
inline |
Sets the max size of the LRU, truncates values if new_max_size < GetSize()
Definition at line 64 of file lru_map.hpp.
template<typename T , typename U , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
template<typename Function >
void cache::LruMap< T, U, Hash, Equal >::VisitAll |
( |
Function && | func | ) |
|
|
inline |
Call Function(const T&, U&) for all items.
Definition at line 79 of file lru_map.hpp.
template<typename T , typename U , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
template<typename Function >
void cache::LruMap< T, U, Hash, Equal >::VisitAll |
( |
Function && | func | ) |
const |
|
inline |
Call Function(const T&, const U&) for all items.
Definition at line 73 of file lru_map.hpp.