cache

package module
v0.0.0-...-278ce41 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxBytes = 1 << 29

DefaultMaxBytes 默认允许占用的最大内存

Variables

This section is empty.

Functions

func CalcLen

func CalcLen(val interface{}) int

Types

type Cache

type Cache interface {
	Set(key string, value interface{})
	Get(Key string) interface{}
	Del(key string)
	DelOldest()
	Len() int
}

Cache 缓存接口

type GetFunc

type GetFunc func(key string) interface{}

func (GetFunc) Get

func (f GetFunc) Get(key string) interface{}

type Getter

type Getter interface {
	Get(key string) interface{}
}

type Stat

type Stat struct {
	NHit, NGet int
}

type TourCache

type TourCache struct {
	// contains filtered or unexported fields
}

func NewTourCache

func NewTourCache(cache Cache, getter Getter) *TourCache

func (*TourCache) Get

func (t *TourCache) Get(Key string) interface{}

func (*TourCache) Set

func (t *TourCache) Set(key string, val interface{})

func (*TourCache) Stat

func (t *TourCache) Stat() *Stat

type Value

type Value interface {
	Len() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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