lru

package
v5.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 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

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]) Flush

func (q *LRU[K, V]) Flush()

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