Documentation ¶
Index ¶
Constants ¶
View Source
const ( IsNull = 1 NotNull = 0 )
null definition
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataLoader ¶
type DataLoader interface { Key() (key string) Value() (value interface{}) // LoadValue return value need cache // if err, nothing will cache // if value == nil, and IsNullCached is true, empty will be cached LoadValue(c context.Context) (value interface{}, err error) Expire() time.Duration Desc() string }
DataLoader cache interface
type MCWrapper ¶
type MCWrapper struct { // 是否缓存空值,防止缓存穿透 IsNullCached bool // contains filtered or unexported fields }
MCWrapper wrapper for mc
func (*MCWrapper) Add ¶
func (m *MCWrapper) Add(c context.Context, data DataLoader) (err error)
Add add cache data
func (*MCWrapper) Delete ¶
func (m *MCWrapper) Delete(c context.Context, data DataLoader) (err error)
Delete delete cache data
Click to show internal directories.
Click to hide internal directories.