Documentation ¶
Index ¶
Constants ¶
View Source
const (
NeverDie = 0 // 是一个常量,永不过期
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache 结构体:封装缓存底层结构
func (*Cache) Set ¶
Set 添加一个键值对到缓存中,不设定ttl,也就意味着数据不会过期 返回error是nil说明添加成功,否则就是添加失败,可能是触发了写满保护机制,拒绝写入数据
func (Cache) SetWithTTL ¶
SetWithTTL 添加一个键值对到缓存中,使用给定的ttl去设定过期时间 返回error是nil说明添加成功,否则就是添加失败,可能是触发了写满保护机制,拒绝写入数据
Click to show internal directories.
Click to hide internal directories.