Skip to main content

Crate reth_lru

Crate reth_lru 

Source
Expand description

A length-limited LRU map tailored to reth’s caches.

Entries live in a Vec of nodes that form a doubly linked list from most to least recently used. A [HashTable] maps keys to node indices, so hashbrown can grow or rehash it freely without invalidating the links. Nodes freed by removals are reused by later inserts, and the node Vec never grows past the length limit.

Insertions that evict return the evicted entry, so callers that need eviction feedback don’t need a second lookup.

Structs§

Iter
Iterator over the entries of an LruMap, from most to least recently used.
LruMap
A hash map holding at most max_length entries that evicts the least recently used entry.