#include <lru-cache.hh>
Public Member Functions | |
LRUCache (size_t capacity) | |
void | upsert (const Key &key, const Value &value) |
bool | erase (const Key &key) |
std::optional< Value > | get (const Key &key) |
size_t | size () const |
void | clear () |
A simple least-recently used cache. Not thread-safe.
|
inline |
Look up an item in the cache. If it exists, it becomes the most recently used item.
Move this item to the back of the LRU list.
|
inline |
Insert or upsert an item in the cache.
Retire the oldest item.