代码拉取完成,页面将自动刷新
package g2cache
// Local memory cache,Local memory cache with high access speed
type LocalCache interface {
Get(key string, obj interface{}) (*Entry, bool, error) // obj represents the internal structure of the real object
Set(key string, e *Entry) error // local storage should set Entry.Obsolete
Del(key string) error
ThreadSafe() // Need to ensure thread safety
Close()
}
// External cache has faster access speed, such as Redis
type OutCache interface {
Get(key string, obj interface{}) (*Entry, bool, error) // obj represents the internal structure of the real object
Set(key string, e *Entry) error // out storage should set Entry.Expiration
Del(key string) error
ThreadSafe() // Need to ensure thread safety
Close()
}
// only out storage pub sub
type PubSub interface {
Subscribe(data chan<- *ChannelMeta) error
Publish(gid, key string, action int8, data *Entry) error
}
// Shouldn't throw a panic, please return an error
type LoadDataSourceFunc func() (interface{}, error)
// Entry expire is UnixNano
const (
SetPublishType int8 = iota
DelPublishType
)
type ChannelMeta struct {
Key string `json:"key"` // cache key
Gid string `json:"gid"` // Used to identify working groups
Action int8 `json:"action"` // SetPublishType,DelPublishType
Data *Entry `json:"data"`
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。