Documentation ¶
Index ¶
- type LRU
- func (l *LRU[K, V]) Cap() int
- func (l *LRU[K, V]) Close()
- func (l *LRU[K, V]) Contains(key K) bool
- func (l *LRU[K, V]) Delete(key K) (prev V, deleted bool)
- func (l *LRU[K, V]) Evict() (key K, value V, evicted bool)
- func (l *LRU[K, V]) ForEach(iter func(key K, value V) bool)
- func (l *LRU[K, V]) Get(key K) (value V, ok bool)
- func (l *LRU[K, V]) Keys() []K
- func (l *LRU[K, V]) Len() int
- func (l *LRU[K, V]) Peek(key K) (value V, ok bool)
- func (l *LRU[K, V]) Put(key K, value V) (prev V, replaced bool)
- func (l *LRU[K, V]) Resize(size int)
- func (l *LRU[K, V]) Values() []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRU ¶
type LRU[K comparable, V any] struct { // contains filtered or unexported fields }
LRU is a thread-safe fixed size LRU cache.
func NewLRU ¶
func NewLRU[K comparable, V any](size int, evicted func(K, V)) *LRU[K, V]
NewLRU returns a new LRU of the given size.
func (*LRU[K, V]) Keys ¶
func (l *LRU[K, V]) Keys() []K
Keys returns a slice of the keys in the cache.
Click to show internal directories.
Click to hide internal directories.