lru

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const NotExpireTTL = time.Hour * 24 * 365 * 10 //不过期时间

Variables

This section is empty.

Functions

This section is empty.

Types

type GCache

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

func NewGCache

func NewGCache(opts ...GCacheOption) *GCache

func (*GCache) Clear

func (this *GCache) Clear()

func (*GCache) Get

func (this *GCache) Get(key string) interface{}

Get 获取缓存

func (*GCache) Len

func (this *GCache) Len() int

func (*GCache) Print

func (this *GCache) Print()

遍历所有元素

func (*GCache) Set

func (this *GCache) Set(key string, newv interface{}, ttl time.Duration)

Set 写入缓存

type GCacheOption

type GCacheOption func(g *GCache)

func WithMaxSize

func WithMaxSize(size int) GCacheOption

type GCacheOptions

type GCacheOptions []GCacheOption

Jump to

Keyboard shortcuts

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