CCF
|
#include <lru.h>
Public Types | |
using | Entry = std::pair< const K, V > |
using | List = std::list< Entry > |
using | Map = std::map< K, typename List::iterator > |
using | Iterator = typename List::iterator |
using | ConstIterator = typename List::const_iterator |
Public Member Functions | |
LRU (size_t max_size) | |
size_t | size () const |
void | set_max_size (size_t ms) |
size_t | get_max_size () const |
Iterator | begin () |
Iterator | end () |
ConstIterator | begin () const |
ConstIterator | end () const |
Iterator | find (const K &k) |
bool | contains (const K &k) const |
void | promote (const Iterator &list_it) |
Iterator | insert (const K &k, V &&v) |
V & | operator[] (const K &k) |
void | clear () |
A basic LRU implementation, written for the specific purpose of managing a cache of Verifiers in CCF. If using for any other purpose, check carefully that this still does what you want!
The search methods (begin, end, find, contains) do not count as access and do not alter the recently used order. Only insert(), promote(), and operator[] modify the order.
using LRU< K, V >::ConstIterator = typename List::const_iterator |
using LRU< K, V >::Entry = std::pair<const K, V> |
using LRU< K, V >::Iterator = typename List::iterator |
using LRU< K, V >::Map = std::map<K, typename List::iterator> |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |