cache

package
v0.0.0-...-0ec8b3e Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

LRU, LFU, SimpleTTL 缓存

可打开统计信息查看命中率等问题

使用方式见 new.go文件

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Name() string
	Len() int
	Get(k interface{}) (interface{}, bool)
	Set(k, v interface{}, ttl time.Duration)
	Remove(k interface{})
	SetEvictCallBack(func(k, v interface{}))
}

func NewLFU

func NewLFU(maxSize int, evictToSize int, name string, openStat bool, emitCounter MetricsCounterFunc) Cache

func NewLRU

func NewLRU(size int, name string, openStat bool, emitCounter MetricsCounterFunc) Cache

func NewSimpleTTL

func NewSimpleTTL(name string) Cache

type MetricsCounterFunc

type MetricsCounterFunc func(name string, value interface{}, prefix string, tagkv map[string]string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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