lru

package
v0.0.0-...-be98215 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2016 License: MIT Imports: 2 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 {
	sync.Mutex
	MaxEntries int           // 0 -> no limit
	OnExpire   ExpireHandler // invoke when expire delete
	// contains filtered or unexported fields
}

func New

func New(maxEntries int, handler ExpireHandler) *Cache

func (*Cache) Add

func (c *Cache) Add(key Key, value Value) (ok bool)

func (*Cache) Get

func (c *Cache) Get(key Key) (Value, bool)

func (*Cache) Len

func (c *Cache) Len() int

func (*Cache) RemoveOldest

func (c *Cache) RemoveOldest()

type ExpireHandler

type ExpireHandler func(Key, Value)

type Key

type Key interface{}

type Value

type Value interface{}

Jump to

Keyboard shortcuts

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