lru

package
v0.0.0-...-35fa672 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 1 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 New

func New(size int, onPurge PurgeCallback) *LRU

func (*LRU) Clear

func (c *LRU) Clear()

func (*LRU) Contains

func (c *LRU) Contains(key interface{}) (ok bool)

func (*LRU) Del

func (c *LRU) Del(key interface{}) bool

func (*LRU) DelOldest

func (c *LRU) DelOldest() (key, value interface{}, ok bool)

func (*LRU) Get

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

func (*LRU) GetOldest

func (c *LRU) GetOldest() (key, value interface{}, ok bool)

GetOldest returns the oldest entry

func (*LRU) GetWithOutUpdate

func (c *LRU) GetWithOutUpdate(key interface{}) (interface{}, bool)

func (*LRU) Keys

func (c *LRU) Keys() []interface{}

func (*LRU) Len

func (c *LRU) Len() int

func (*LRU) Resize

func (c *LRU) Resize(size int) (evicted int)

func (*LRU) Set

func (c *LRU) Set(k, v interface{}) bool

ret if some value is replaced

type PurgeCallback

type PurgeCallback func(interface{}, interface{})

when the item is remove, it will call to tell the user

Jump to

Keyboard shortcuts

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