template <typename K, typename V>

class BoundedLruCache

Defined at line 58 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

`BoundedLruCache` implements a bounded-size cache where the least recently used entry is evicted

when a new one is added. Accessing an existing entry, either by `Get()` or setting a new value

with `Put()`, causes that entry to become the most recently used.

This implementation is optimized for cases where the keys are quite large compared to the values

(although it will work fine in the opposite case, too). A naive implementation would store two

copies of each key: one in `map_` for lookup and one in `lru_list_` for eviction. Instead, the

key exists only in `lru_list_`, and `map_` is keyed by a reference to that key.

Both the key and value types must be copy-constructable.

Thread-safety: This class is thread-unsafe; concurrent access must be externally synchronized.

Public Methods

void BoundedLruCache<K, V> (size_t capacity)

Defined at line 74 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

void BoundedLruCache<K, V> (const BoundedLruCache<K, V> & other)

Not moveable, not copyable.

Defined at line 79 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

void BoundedLruCache<K, V> (BoundedLruCache<K, V> && other)

Defined at line 80 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

BoundedLruCache<K, V> & operator= (const BoundedLruCache<K, V> & other)

Defined at line 81 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

BoundedLruCache<K, V> & operator= (BoundedLruCache<K, V> && other)

Defined at line 82 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

void Put (const Key & key, const Value & value)

Defined at line 84 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

std::optional<Value> Get (const Key & key)

Defined at line 111 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

Iterator begin ()

Iterators in MRU (most recently used) order.

Defined at line 123 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

Iterator end ()

Defined at line 124 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

size_t size ()

Defined at line 126 of file ../../src/ui/scenic/lib/display/internal/check_config_cache.h

Records