cache

package
v0.0.0-...-a18df83 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key interface{}) (interface{}, error)

获取缓存

func GetOrSetFunc

func GetOrSetFunc(key interface{}, f func() (interface{}, error), duration time.Duration) (interface{}, error)

获取一个缓存值,当缓存不存在时执行指定的函数

func GetOrSetFuncLock

func GetOrSetFuncLock(key interface{}, f func() (interface{}, error), duration time.Duration) (interface{}, error)

带锁机制的缓存判断,缓存项不存在时只会执行一次,全局缓存锁

func Remove

func Remove(key interface{}) error

删除缓存

func Set

func Set(key, value interface{}, duration time.Duration) error

设置缓存

Types

This section is empty.

Jump to

Keyboard shortcuts

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