Documentation
¶
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 { // If len > UpperBound, cache will automatically evict // down to LowerBound. If either value is 0, this behavior // is disabled. UpperBound int LowerBound int EvictionChannel chan<- Eviction[K, V] // contains filtered or unexported fields }
func (*Cache[K, V]) Get ¶
func (c *Cache[K, V]) Get(key K) *V
Get retrieves the key's value if it exists, incrementing the frequency. It returns nil if there is no value for the given key.
func (*Cache[K, V]) GetFrequency ¶
GetFrequency returns the frequency count of the given key
type Eviction ¶
type Eviction[K comparable, V any] struct { Key K Value V }
Click to show internal directories.
Click to hide internal directories.