lru

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(size int, onEvict EvictCallback) (*Cache, error)

func (*Cache) Add

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

func (*Cache) Contains

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

func (*Cache) ForEach

func (c *Cache) ForEach(callback func(value interface{}))

func (*Cache) Get

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

func (*Cache) GetOldest

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

func (*Cache) Keys

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

func (*Cache) Len

func (c *Cache) Len() int

func (*Cache) Peek

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

func (*Cache) Purge

func (c *Cache) Purge()

func (*Cache) Remove

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

func (*Cache) RemoveOldest

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

func (*Cache) RemoveWithoutCallback

func (c *Cache) RemoveWithoutCallback(key interface{}) (present bool)

type EvictCallback

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

Jump to

Keyboard shortcuts

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