Documentation
¶
Index ¶
- type EntityCache
- type EntityCacheImpl
- func (cache *EntityCacheImpl) BeginRequest(worker freedom.Worker)
- func (cache *EntityCacheImpl) CloseRedis() EntityCache
- func (cache *EntityCacheImpl) Delete(result freedom.Entity, async ...bool) error
- func (cache *EntityCacheImpl) GetEntity(result freedom.Entity) error
- func (cache *EntityCacheImpl) SetAsyncWrite(open bool) EntityCache
- func (cache *EntityCacheImpl) SetExpiration(expiration time.Duration) EntityCache
- func (cache *EntityCacheImpl) SetPrefix(prefix string) EntityCache
- func (cache *EntityCacheImpl) SetSingleFlight(open bool) EntityCache
- func (cache *EntityCacheImpl) SetSource(call func(result freedom.Entity) error) EntityCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntityCache ¶
type EntityCache interface { //获取实体 GetEntity(freedom.Entity) error //删除实体缓存 Delete(result freedom.Entity, async ...bool) error //设置数据源 SetSource(func(freedom.Entity) error) EntityCache //设置前缀 SetPrefix(string) EntityCache //设置缓存时间,默认5分钟 SetExpiration(time.Duration) EntityCache //设置异步反写缓存。默认关闭,缓存未命中读取数据源后的异步反写缓存 SetAsyncWrite(bool) EntityCache //设置防击穿,默认开启 SetSingleFlight(bool) EntityCache //关闭二级缓存. 关闭后只有一级缓存生效 CloseRedis() EntityCache }
EntityCache .
type EntityCacheImpl ¶
EntityCacheImpl .
func (*EntityCacheImpl) BeginRequest ¶
func (cache *EntityCacheImpl) BeginRequest(worker freedom.Worker)
BeginRequest .
func (*EntityCacheImpl) CloseRedis ¶
func (cache *EntityCacheImpl) CloseRedis() EntityCache
CloseRedis 关闭二级缓存
func (*EntityCacheImpl) Delete ¶
func (cache *EntityCacheImpl) Delete(result freedom.Entity, async ...bool) error
Delete 删除实体缓存
func (*EntityCacheImpl) GetEntity ¶
func (cache *EntityCacheImpl) GetEntity(result freedom.Entity) error
GetEntity 读取实体缓存
func (*EntityCacheImpl) SetAsyncWrite ¶
func (cache *EntityCacheImpl) SetAsyncWrite(open bool) EntityCache
SetAsyncWrite 设置异步写入,默认同步写入缓存。 当缓存未命中读取数据源后是否异步写入缓存
func (*EntityCacheImpl) SetExpiration ¶
func (cache *EntityCacheImpl) SetExpiration(expiration time.Duration) EntityCache
SetExpiration 设置缓存实体时间 默认5分钟
func (*EntityCacheImpl) SetPrefix ¶
func (cache *EntityCacheImpl) SetPrefix(prefix string) EntityCache
SetPrefix 设置缓存实体前缀
func (*EntityCacheImpl) SetSingleFlight ¶
func (cache *EntityCacheImpl) SetSingleFlight(open bool) EntityCache
SetSingleFlight 默认开启
func (*EntityCacheImpl) SetSource ¶
func (cache *EntityCacheImpl) SetSource(call func(result freedom.Entity) error) EntityCache
SetSource 设置数据源
Click to show internal directories.
Click to hide internal directories.