Documentation ¶
Overview ¶
Package lru_map implements an extremely basic in-memory LRU cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRUMap ¶
type LRUMap[K comparable, V any] interface { // Associate a value with a key in the map. If the map is full, the oldest // entry will be deleted. Set(K, V) // Retrieve the value associated with the given key. If the value is not // present, it will return false. This can happen either because the value // has not been set for the key, or its entry has been evicted. Get(K) (V, bool) // Remove an element from the map. This can improve efficiency as it allows // other objects to remain cached for longer. Drop(K) // Get all the keys present in the map. Keys() iter.Seq[K] }
An LRUMap is a generic Map type, with an LRU eviction policy.
Directories ¶
Path | Synopsis |
---|---|
A way worse implementation of LRUMap, its only function is to be so obvious in its implementation that its behavior is self-evidently correct, allowing it to be used as a reference in tests.
|
A way worse implementation of LRUMap, its only function is to be so obvious in its implementation that its behavior is self-evidently correct, allowing it to be used as a reference in tests. |
Click to show internal directories.
Click to hide internal directories.