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) 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 { //Gets the entity. GetEntity(freedom.Entity) error //Delete the entity. Delete(result freedom.Entity, async ...bool) error //Set up the data source. SetSource(func(freedom.Entity) error) EntityCache //Set the prefix for cache KEY. SetPrefix(string) EntityCache //Set the time of life, The default is 5 minutes. SetExpiration(time.Duration) EntityCache // Turn asynchronous writes on or off // The default is to close. // Cache misses read the database. SetAsyncWrite(bool) EntityCache //Turn off redis and only request memory takes effect. CloseRedis() EntityCache }
EntityCache The entity cache component. The first and second level caches are implemented. The first-level cache uses the requested memory. Can prevent breakdown.
type EntityCacheImpl ¶
EntityCacheImpl .
func (*EntityCacheImpl) BeginRequest ¶
func (cache *EntityCacheImpl) BeginRequest(worker freedom.Worker)
BeginRequest Polymorphic method, subclasses can override overrides overrides. The request is triggered after entry.
func (*EntityCacheImpl) CloseRedis ¶
func (cache *EntityCacheImpl) CloseRedis() EntityCache
CloseRedis Turn off redis and only request memory takes effect.
func (*EntityCacheImpl) Delete ¶
func (cache *EntityCacheImpl) Delete(result freedom.Entity, async ...bool) error
Delete the entity.
func (*EntityCacheImpl) GetEntity ¶
func (cache *EntityCacheImpl) GetEntity(result freedom.Entity) error
GetEntity Gets the entity.
func (*EntityCacheImpl) SetAsyncWrite ¶
func (cache *EntityCacheImpl) SetAsyncWrite(open bool) EntityCache
SetAsyncWrite . Turn asynchronous writes on or off The default is to close. Cache misses read the database.
func (*EntityCacheImpl) SetExpiration ¶
func (cache *EntityCacheImpl) SetExpiration(expiration time.Duration) EntityCache
SetExpiration Set the time of life, The default is 5 minutes.
func (*EntityCacheImpl) SetPrefix ¶
func (cache *EntityCacheImpl) SetPrefix(prefix string) EntityCache
SetPrefix Set the prefix for cache KEY.
func (*EntityCacheImpl) SetSource ¶
func (cache *EntityCacheImpl) SetSource(call func(result freedom.Entity) error) EntityCache
SetSource Set up the data source.