#include <core/util/lru.hpp>
|
std::pair< bool, Value > | query (const Key &key) |
|
void | insert (const Key &key, const Value &value) |
|
const_iterator | begin () const |
|
const_iterator | end () const |
|
const_reverse_iterator | rbegin () const |
|
const_reverse_iterator | rend () const |
|
size_t | size () const |
| Returns the current size of the cache.
|
|
void | set_size_limit (size_t limit) |
| Sets the upper limit on the size of the cache.
|
|
size_t | get_size_limit () const |
| Gets the upper limit of the size of the cache.
|
|
size_t | hits () const |
| Returns the number of query hits.
|
|
size_t | misses () const |
| Returns the number of query misses.
|
|
template<typename Key, typename Value>
struct turi::lru_cache< Key, Value >
A simple general purpose LRU cache implementation.
Definition at line 21 of file lru.hpp.
◆ begin()
template<typename Key, typename Value>
Retuns an iterator to the data
Definition at line 93 of file lru.hpp.
◆ end()
template<typename Key, typename Value>
Retuns an iterator to the data
Definition at line 101 of file lru.hpp.
◆ insert()
template<typename Key, typename Value>
void turi::lru_cache< Key, Value >::insert |
( |
const Key & |
key, |
|
|
const Value & |
value |
|
) |
| |
|
inline |
Inserts a key into the cache. If the key already exists, it is overwritten. If the size of the cache is larger than the limit, the least recently used items are erased.
Definition at line 67 of file lru.hpp.
◆ query()
template<typename Key, typename Value>
std::pair<bool, Value> turi::lru_cache< Key, Value >::query |
( |
const Key & |
key | ) |
|
|
inline |
queries for a particular key. If it does not exist {false, Value()} is returned. If it exists {true, value} is returned and the key is bumped to the front of the cache.
Definition at line 48 of file lru.hpp.
◆ rbegin()
template<typename Key, typename Value>
Iterator to cache in reverse
Definition at line 107 of file lru.hpp.
◆ rend()
template<typename Key, typename Value>
Iterator to cache in reverse
Definition at line 113 of file lru.hpp.
The documentation for this struct was generated from the following file: