lru

package
v4.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV added in v4.1.7

type KV[K comparable, V any] struct {
	// contains filtered or unexported fields
}

type LRU

type LRU[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewLRU

func NewLRU[K comparable, V any](maxSize int, onEvict func(key K, v V)) *LRU[K, V]

func (*LRU[K, V]) Add

func (q *LRU[K, V]) Add(key K, v V)

func (*LRU[K, V]) Clean

func (q *LRU[K, V]) Clean(f func(key K, v V) (remove bool)) (removed int)

func (*LRU[K, V]) Del

func (q *LRU[K, V]) Del(key K)

func (*LRU[K, V]) Get

func (q *LRU[K, V]) Get(key K) (v V, ok bool)

func (*LRU[K, V]) Len

func (q *LRU[K, V]) Len() int

func (*LRU[K, V]) PopOldest

func (q *LRU[K, V]) PopOldest() (key K, v V, ok bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL