Documentation
¶
Overview ¶
Package lru implements a LRU based 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 encapsulates a thread-safe fixed size LRU cache.
func NewWithEvict ¶ added in v0.74.0
func NewWithEvict[k comparable, v any](size int, useCase string, onEvict func(k, v)) (*Cache[k, v], error)
NewWithEvict returns a new LRU cache that can hold 'size' number of keys at a time.
func (*Cache[k, v]) Get ¶
Get executes a lookup and returns whether a key exists in the cache along with its value.
Click to show internal directories.
Click to hide internal directories.