Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New[K comparable, V any](capacity int) *builder[K, V]
New initializes a builder to create an LFU cache.
Types ¶
type Cache ¶ added in v0.2.0
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache is a configured least frequently used cache ready for use.
func (*Cache[K, V]) Clear ¶ added in v0.2.0
func (cache *Cache[K, V]) Clear()
Clear empties the cache.
func (*Cache[K, V]) Get ¶ added in v0.2.0
Get attempts to find an existing cache entry by key. It returns an Option you must check before using the underlying value.
func (*Cache[K, V]) Remove ¶ added in v0.2.0
func (cache *Cache[K, V]) Remove(key K)
Remove removes the item matching the provided key from the cache, if not present is a noop.
Click to show internal directories.
Click to hide internal directories.