lfu

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	TTL              int64
	EvictionChannel  chan<- Eviction
	WriteBackChannel chan<- Eviction
	// contains filtered or unexported fields
}

func New

func New() *Cache

func (*Cache) Delete

func (c *Cache) Delete(key string)

func (*Cache) DeletePrefix added in v0.2.5

func (c *Cache) DeletePrefix(prefix string)

func (*Cache) Evict

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

func (*Cache) Get

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

func (*Cache) GetOrSet

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

func (*Cache) Iterate added in v0.16.0

func (c *Cache) Iterate(fn func(k string, v interface{}) error) error

func (*Cache) Len

func (c *Cache) Len() int

func (*Cache) Set

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

func (*Cache) WriteBack

func (c *Cache) WriteBack() (persisted, evicted int)

WriteBack persists modified items and evicts obsolete ones.

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