lru

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncapsulatedValue

type EncapsulatedValue struct {
	Value       interface{}
	LastUseTime time.Time
}

type LRU

type LRU struct {
	// contains filtered or unexported fields
}

func New

func New(strategy LimitStrategy, limit int64) *LRU

func (*LRU) Get

func (l *LRU) Get(key interface{}) (value interface{})

func (*LRU) GetKeys

func (l *LRU) GetKeys() (keys []interface{})

func (*LRU) GetOrInsert

func (l *LRU) GetOrInsert(key interface{}, valFunc func() (val interface{})) (val interface{}, removed []*EncapsulatedValue)

func (*LRU) Insert

func (l *LRU) Insert(key interface{}, val interface{}) (removed []*EncapsulatedValue)

type LimitStrategy

type LimitStrategy int
const (
	FixedLength LimitStrategy = iota
	FixedTimeout
)

Jump to

Keyboard shortcuts

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