Documentation ¶
Overview ¶
Package clientkeybatch redis的keybatch包装
Index ¶
- Variables
- type ClientKeyBatch
- func (k *ClientKeyBatch) AllExists(ctx context.Context) (bool, error)
- func (k *ClientKeyBatch) AnyExists(ctx context.Context) (bool, error)
- func (k *ClientKeyBatch) AutoRefresh() error
- func (k *ClientKeyBatch) Delete(ctx context.Context) error
- func (k *ClientKeyBatch) HasSameType(ctx context.Context) (bool, string, error)
- func (k *ClientKeyBatch) RefreshTTL(ctx context.Context) error
- func (k *ClientKeyBatch) StopAutoRefresh(force bool) error
- func (k *ClientKeyBatch) TTL(ctx context.Context) (map[string]time.Duration, error)
- func (k *ClientKeyBatch) ToArray() []*clientkey.ClientKey
- func (k *ClientKeyBatch) Types(ctx context.Context) (map[string]string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrBatchNotSetMaxTLL = errors.New("batch没有设置最大tll")
ErrBatchNotSetMaxTLL batch没有设置最大tll
var ErrKeysMustMoreThanOne = errors.New("keys参数个数必须大于0")
ErrKeysMustMoreThanOne keys参数个数必须大于0
var ErrKeysMustSameClient = errors.New("keys必须使用相同的客户端对象")
ErrKeysMustSameClient keys必须使用相同的客户端对象
var ErrKeysMustSameType = errors.New("keys必须为相同的类型")
ErrKeysMustSameType keys必须为相同的类型
Functions ¶
This section is empty.
Types ¶
type ClientKeyBatch ¶
type ClientKeyBatch struct { Keys []string Opt clientkey.Options Client redis.UniversalClient // contains filtered or unexported fields }
ClientKeyBatch 描述任意一种的一批key对象
func New ¶
func New(client redis.UniversalClient, keys []string, opts ...clientkey.Option) *ClientKeyBatch
New 创建一个新的key对象 @params client redis.UniversalClient 客户端对象 @params key string bitmap使用的key @params opts ...*KeyOption key的选项
func (*ClientKeyBatch) AllExists ¶
func (k *ClientKeyBatch) AllExists(ctx context.Context) (bool, error)
AllExists 查看key是否存在 @params ctx context.Context 上下文信息,用于控制请求的结束
func (*ClientKeyBatch) AnyExists ¶
func (k *ClientKeyBatch) AnyExists(ctx context.Context) (bool, error)
AnyExists 查看key是否存在 @params ctx context.Context 上下文信息,用于控制请求的结束
func (*ClientKeyBatch) AutoRefresh ¶
func (k *ClientKeyBatch) AutoRefresh() error
AutoRefresh 自动刷新key的过期时间
func (*ClientKeyBatch) Delete ¶
func (k *ClientKeyBatch) Delete(ctx context.Context) error
Delete 删除key @params ctx context.Context 上下文信息,用于控制请求的结束
func (*ClientKeyBatch) HasSameType ¶
HasSameType 判断这一批键是否都是同一类型 @params ctx context.Context 上下文信息,用于控制请求的结束 @returns bool 是否类型一致 @returns string 当类型一致时返回类型名 @returns error 执行时的错误
func (*ClientKeyBatch) RefreshTTL ¶
func (k *ClientKeyBatch) RefreshTTL(ctx context.Context) error
RefreshTTL 刷新key的生存时间 @params ctx context.Context 上下文信息,用于控制请求的结束
func (*ClientKeyBatch) StopAutoRefresh ¶
func (k *ClientKeyBatch) StopAutoRefresh(force bool) error
StopAutoRefresh 取消自动更新缓存 @params force bool 强制停下整个定时任务cron对象
func (*ClientKeyBatch) TTL ¶
TTL 查看key的剩余时间 @params ctx context.Context 上下文信息,用于控制请求的结束 @returns map[string]time.Duration key为键,value为键的类型,如果键不存在,则为-2,如果键未设置过期则返回-1 @returns error 执行时的错误
func (*ClientKeyBatch) ToArray ¶
func (k *ClientKeyBatch) ToArray() []*clientkey.ClientKey
ToArray 将batch转化为key的序列