Documentation ¶
Index ¶
- func ActionRedisSync(time time.Duration, f func(client redis2.UniversalClient) error)
- func CacheAndRedisGet(ctx context.Context, key string, obj interface{}) (bool, error)
- func Get(ctx context.Context, key string) (string, bool, error)
- func GetWithFunc(ctx context.Context, key string, ...) (string, error)
- func ScanGet(ctx context.Context, key string, obj interface{}, collectionName string) (bool, error)
- func ScanTagDelete(ctx context.Context, key string, obj interface{})
- func ScanWriteCache(ctx context.Context, key string, obj interface{}, state bool) (err error)
- func TagDelete(ctx context.Context, key string)
- func Write(ctx context.Context, key string, value string, state bool)
- type TimeTicker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActionRedisSync ¶
func ActionRedisSync(time time.Duration, f func(client redis2.UniversalClient) error)
func CacheAndRedisGet ¶
CacheAndRedisGet 从内存缓存和redis中获取数据
func GetWithFunc ¶
func GetWithFunc(ctx context.Context, key string, f func(ctx context.Context, key string) (string, error)) (string, error)
GetWithFunc 从缓存中获取字符串,如果没有就调用func函数获取
func ScanTagDelete ¶
ScanTagDelete 将缓存值标记为删除,下次从cache读取时会回调到数据库
func ScanWriteCache ¶
ScanWriteCache 将数据写入缓存,如果state为false,那么只写入本地缓存,否则同时写入redis
Types ¶
type TimeTicker ¶
type TimeTicker struct { Tick *time.Ticker Work func(client redis2.UniversalClient) error }
func NewTick ¶
func NewTick(interval time.Duration, f func(client redis2.UniversalClient) error) *TimeTicker
func (*TimeTicker) Start ¶
func (t *TimeTicker) Start()
Click to show internal directories.
Click to hide internal directories.