Documentation ¶
Index ¶
Constants ¶
View Source
const ( LevelDisable = iota + 1 // 禁用缓存 LevelModel // 模型缓存 LevelAll // 全部缓存 )
缓存等级
Variables ¶
View Source
var DefaultOption = &Option{ Expires: time.Second * 120, Level: LevelAll, AsyncWrite: true, RefreshExpires: true, PenetrationSafe: true, Logger: logger.Logger{}, }
View Source
var IsCount = errors.New("is count")
View Source
var PrimaryCacheHit = errors.New("primary cache hit")
View Source
var SearchCacheHit = errors.New("search cache hit")
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) AfterQuery ¶
func (*Engine) BeforeQuery ¶
func (*Engine) CreateCallback ¶
func (*Engine) DeleteCallback ¶
func (*Engine) UpdateCallback ¶
type JsonSearch ¶
type JsonSearch struct {
PrimaryKeys []string `json:"primary_keys"`
}
type Option ¶
type Option struct { Expires time.Duration // 默认120秒,30-43200 Level int // 默认LevelSearch,LevelDisable:关闭,LevelModel:模型缓存, LevelAll:全部缓存 AsyncWrite bool // 默认false, insert update delete 成功后是否异步更新缓存 RefreshExpires bool // 是否缓存刷新缓存时长 PenetrationSafe bool // 默认false, 开启防穿透。 Logger logger.Interface //日志记录 }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.