lru

package module
v0.0.0-...-d8316af Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: MIT Imports: 2 Imported by: 0

README

lru

You should know what it is. That's all.

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
}

Cache is an LRU cache. It is safe for concurrent access.

func Lru

func Lru(maxEntries int) *Cache

Alias for New.

func New

func New(maxEntries int) *Cache

New creates a new Cache. If maxEntries is zero, the cache has no limit.

func (*Cache) Del

func (c *Cache) Del(key Key)

Del removes the provided key from the cache.

func (*Cache) Get

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

Get looks up a key's value from the cache.

func (*Cache) Len

func (c *Cache) Len() int

Len returns the number of items in the cache.

func (*Cache) Set

func (c *Cache) Set(key Key, value Value)

Set adds a value to the cache.

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