cache

package
v0.0.0-...-c6549bd Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 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 {
	// If len > UpperBound, cache will automatically evict
	// down to LowerBound.  If either value is 0, this behavior
	// is disabled.
	UpperBound int
	LowerBound int

	Lock            *sync.Mutex
	EvictionChannel chan<- Eviction
	// contains filtered or unexported fields
}

func New

func New() *Cache

func (*Cache) Evict

func (c *Cache) Evict(count int) int

func (*Cache) Get

func (c *Cache) Get(key string) interface{}

func (*Cache) GetKeys

func (c *Cache) GetKeys() []string

func (*Cache) Len

func (c *Cache) Len() int

func (*Cache) Set

func (c *Cache) Set(key string, value interface{})

func (*Cache) Update

func (c *Cache) Update(key string, value interface{}) bool

type Eviction

type Eviction struct {
	Key   string
	Value interface{}
}

Jump to

Keyboard shortcuts

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