clientkeybatch

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package clientkeybatch redis的keybatch包装

Index

Constants

This section is empty.

Variables

View Source
var ErrBatchNotSetMaxTLL = errors.New("batch没有设置最大tll")

ErrBatchNotSetMaxTLL batch没有设置最大tll

View Source
var ErrKeysMustMoreThanOne = errors.New("keys参数个数必须大于0")

ErrKeysMustMoreThanOne keys参数个数必须大于0

View Source
var ErrKeysMustSameClient = errors.New("keys必须使用相同的客户端对象")

ErrKeysMustSameClient keys必须使用相同的客户端对象

View Source
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

func (k *ClientKeyBatch) HasSameType(ctx context.Context) (bool, string, error)

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

func (k *ClientKeyBatch) TTL(ctx context.Context) (map[string]time.Duration, error)

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的序列

func (*ClientKeyBatch) Types

func (k *ClientKeyBatch) Types(ctx context.Context) (map[string]string, error)

Types 查看这批key的的类型 @params ctx context.Context 上下文信息,用于控制请求的结束 @returns map[string]string key为键,value为键的类型,如果键不存在,则为空字符串 @returns error 执行时的错误

Jump to

Keyboard shortcuts

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