lrucache

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes []byte

func (Bytes) Bytes

func (b Bytes) Bytes() []byte

func (Bytes) SetBytes

func (b Bytes) SetBytes()

func (Bytes) Size

func (b Bytes) Size() int64

type BytesLike

type BytesLike interface {
	Bytes() []byte
}

type LRU

type LRU[K comparable, V BytesLike] struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New[K comparable, V BytesLike](
	capacity int64,
	postSet func(keySet K, valSet V),
	postGet func(key K, value V),
	postEvict func(keyEvicted K, valEvicted V),
) *LRU[K, V]

func (*LRU[K, V]) Available

func (l *LRU[K, V]) Available() int64

func (*LRU[K, V]) Capacity

func (l *LRU[K, V]) Capacity() int64

func (*LRU[K, V]) DeletePaths added in v1.1.1

func (l *LRU[K, V]) DeletePaths(ctx context.Context, paths []string)

func (*LRU[K, V]) Flush

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

func (*LRU[K, V]) Get

func (l *LRU[K, V]) Get(ctx context.Context, key K) (value V, ok bool)

func (*LRU[K, V]) Set

func (l *LRU[K, V]) Set(ctx context.Context, key K, value V)

func (*LRU[K, V]) Used

func (l *LRU[K, V]) Used() int64

Jump to

Keyboard shortcuts

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