store

package
v1.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

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

type EntityCacheImpl struct {
	freedom.Infra
	// contains filtered or unexported fields
}

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 设置数据源

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL