![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <lru-cache.hh>
Public Member Functions | |
| LRUCache (size_t capacity) | |
| template<typename K> | |
| void | upsert (const K &key, const Value &value) |
| template<typename K> | |
| bool | erase (const K &key) |
| template<typename K> | |
| std::optional< Value > | get (const K &key) |
| template<typename K> | |
| Value * | getOrNullptr (const K &key) |
| size_t | size () const noexcept |
| void | clear () noexcept |
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.
|
inline |
Look up an item in the cache. If it exists, it becomes the most recently used item.
|
inline |
Insert or upsert an item in the cache.
Retire the oldest item.