lru

package
v0.0.0-...-5c7516f Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.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 EvictCallback

type EvictCallback func(key interface{}, value interface{})

type LRU

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

func NewLRU

func NewLRU(size int64, onEvict EvictCallback) (*LRU, error)

func (*LRU) Add

func (c *LRU) Add(key, value interface{}) (evicted bool)

func (*LRU) Contains

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

func (*LRU) Get

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

func (*LRU) GetOldest

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

func (*LRU) Keys

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

func (*LRU) Len

func (c *LRU) Len() int

func (*LRU) Peek

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

func (*LRU) Purge

func (c *LRU) Purge()

func (*LRU) Remove

func (c *LRU) Remove(key interface{}) (present bool)

func (*LRU) RemoveOldest

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

func (*LRU) Resize

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

Jump to

Keyboard shortcuts

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