lru

package
Version: v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 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 LRU

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

func NewLRU

func NewLRU(maxSize int, onEvict func(key string, v interface{})) *LRU

func (*LRU) Add

func (q *LRU) Add(key string, v interface{})

func (*LRU) Clean

func (q *LRU) Clean(f func(key string, v interface{}) (remove bool)) (removed int)

func (*LRU) Del

func (q *LRU) Del(key string)

func (*LRU) Get

func (q *LRU) Get(key string) (interface{}, bool)

func (*LRU) Len

func (q *LRU) Len() int

func (*LRU) PopOldest

func (q *LRU) PopOldest() (key string, v interface{}, ok bool)

type LRULike

type LRULike interface {
	Add(key string, v interface{})
	Del(key string)
	Clean(f func(key string, v interface{}) (remove bool)) (removed int)
	Get(key string) (v interface{}, ok bool)
	Len() int
}

Source Files

Jump to

Keyboard shortcuts

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