lru

package
v0.0.0-...-1b09624 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLruNotFoundKey = errors.New("lru key not exist")

Functions

This section is empty.

Types

type LRUCache

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

func NewLRUCache

func NewLRUCache(maxCount int, ttl int) *LRUCache

param: length 长度 param: ttl 缓存有效期 (s)

func (*LRUCache) Get

func (cache *LRUCache) Get(key string) (interface{}, error)

获取

func (*LRUCache) GetHitCount

func (cache *LRUCache) GetHitCount() int64

获取命中次数

func (*LRUCache) GetKeysCount

func (cache *LRUCache) GetKeysCount() int64

获取当前key数量,包括未过期和已过期的

func (*LRUCache) GetRequestCount

func (cache *LRUCache) GetRequestCount() int64

获取请求次数

func (*LRUCache) Update

func (cache *LRUCache) Update(key string, value interface{}) error

写入

Jump to

Keyboard shortcuts

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