|
| | Cache () |
| | Cache (size_type max_size) |
| void | invalidate () |
| | Clear the cache.
|
| bool | has (Key const &k) const |
| | Query if k is contained in the cache.
|
| size_type | size () const |
| | Number of elements currently cached.
|
| size_type | max_size () const |
| | Maximal size of the cache.
|
| template<typename ValueRef> |
| Value const * | put (Key const &k, ValueRef &&v) |
| | Put a value into the cache.
|
| template<typename KeyInputIterator, typename ValueInputIterator> |
| KeyInputIterator | put (KeyInputIterator kbegin, KeyInputIterator kend, ValueInputIterator vbegin) |
| | Put a range of values into the cache.
|
| Value const * | get (Key const &k) const |
| | Get a value.
|
template<typename Key, typename Value>
class Utils::Cache< Key, Value >
Definition at line 30 of file Cache.hpp.
template<typename Key, typename Value>
template<typename ValueRef>
| Value const * Utils::Cache< Key, Value >::put |
( |
Key const & | k, |
|
|
ValueRef && | v ) |
|
inline |
Put a value into the cache.
If the value already exists, it is overwritten. When the size of the cache would grow below the maximal size, a random element is removed before putting the new one.
Definition at line 113 of file Cache.hpp.
References has().
Referenced by put().
template<typename Key, typename Value>
template<typename KeyInputIterator, typename ValueInputIterator>
| KeyInputIterator Utils::Cache< Key, Value >::put |
( |
KeyInputIterator | kbegin, |
|
|
KeyInputIterator | kend, |
|
|
ValueInputIterator | vbegin ) |
|
inline |
Put a range of values into the cache.
If the values already exists, it is overwritten. When the size of the cache would grow below the maximal size, a random elements are removed until all of the new values fit. If the given range is larger than max_size(), only the first max_size() elements are put into the cache.
- Template Parameters
-
| KeyInputIterator | iterator of keys, at least InputIterator. |
| ValueInputIterator | iterator of value, at least InputIterator. |
- Returns
- KeyInputIterator one past the last element that was put into the cache.
Definition at line 150 of file Cache.hpp.
References max_size(), put(), and size().