mapCache

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MapCacher sync.Map
View Source
var MapCacherExpiration sync.Map

Functions

func Cache

func Cache(keyName string, expiration int, cacheFunc CacheFunc, cacheParameters ...any) (any, error)

获取变量 不存在则自动设置

func Clear

func Clear()

清空

func Delete added in v1.2.2

func Delete(key string)

删除指定缓存

func InitCacheName

func InitCacheName(keyName string, cacheParameters ...any) string

组合缓存名称

func Remove

func Remove(name string)

删除 模糊搜索方式

func Set

func Set(keyName string, expiration int, data any)

设置缓存

func Start added in v1.5.5

func Start(GCIntervalTime int64)

初始化

Types

type CacheFunc

type CacheFunc func(args ...any) (any, error)

缓存数据读取函数

Jump to

Keyboard shortcuts

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