Documentation ¶
Overview ¶
Package lru implements a constant time, generic LRU cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache exposes an interface for an LRU cache.
func New ¶
func New[K comparable, V any](capacity uint) *Cache[K, V]
New returns a new cache with the given capacity.
func (*Cache[K, V]) ForEach ¶
ForEach runs the given function for each key/value pair in the cache, iteration takes place with most used first.
Click to show internal directories.
Click to hide internal directories.