Documentation
¶
Index ¶
- func MemoryUsage(ctx context.Context, client redis.Cmdable, key string) (size int64, err error)
- func ValueType(ctx context.Context, client redis.Cmdable, key string) (ValueType string, err error)
- type Arg
- type ArgCache
- type ClusterService
- func (this_ *ClusterService) Close()
- func (this_ *ClusterService) DelPattern(pattern string, args ...Arg) (count int, err error)
- func (this_ *ClusterService) GetClient(args ...Arg) (client redis.Cmdable, err error)
- func (this_ *ClusterService) GetValueInfo(key string, args ...Arg) (valueInfo *ValueInfo, err error)
- func (this_ *ClusterService) Keys(pattern string, args ...Arg) (keysResult *KeysResult, err error)
- func (this_ *ClusterService) Scan(pattern string, args ...Arg) (keysResult *KeysResult, err error)
- func (this_ *ClusterService) ValueType(key string, args ...Arg) (valueType string, err error)
- type CmdService
- func (this_ *CmdService) BitCount(key string, args ...Arg) (count int64, err error)
- func (this_ *CmdService) BitSet(key string, offset int64, value int, args ...Arg) (err error)
- func (this_ *CmdService) Del(key string, args ...Arg) (count int, err error)
- func (this_ *CmdService) Exists(key string, args ...Arg) (res int64, err error)
- func (this_ *CmdService) Expire(key string, expire int64, args ...Arg) (res bool, err error)
- func (this_ *CmdService) Get(key string, args ...Arg) (value string, err error)
- func (this_ *CmdService) HashDel(key string, field string, args ...Arg) (err error)
- func (this_ *CmdService) HashGet(key string, field string, args ...Arg) (value string, err error)
- func (this_ *CmdService) HashGetAll(key string, args ...Arg) (value map[string]string, err error)
- func (this_ *CmdService) HashSet(key string, field string, value string, args ...Arg) (err error)
- func (this_ *CmdService) Incr(key string, value int64, args ...Arg) (res int64, err error)
- func (this_ *CmdService) Info(args ...Arg) (res string, err error)
- func (this_ *CmdService) IsNotFound(err error) (res bool)
- func (this_ *CmdService) ListPush(key string, value string, args ...Arg) (err error)
- func (this_ *CmdService) ListRPush(key string, value string, args ...Arg) (err error)
- func (this_ *CmdService) ListRem(key string, count int64, value string, args ...Arg) (err error)
- func (this_ *CmdService) ListSet(key string, index int64, value string, args ...Arg) (err error)
- func (this_ *CmdService) Persist(key string, args ...Arg) (res bool, err error)
- func (this_ *CmdService) ScriptRun(src string, KEYS []string, ARGV interface{}, args ...Arg) (value interface{}, err error)
- func (this_ *CmdService) Set(key string, value string, args ...Arg) (err error)
- func (this_ *CmdService) SetAdd(key string, value string, args ...Arg) (err error)
- func (this_ *CmdService) SetCard(key string, args ...Arg) (res int64, err error)
- func (this_ *CmdService) SetRem(key string, value string, args ...Arg) (err error)
- func (this_ *CmdService) SetThrowNotFoundErr(ThrowNotFoundErr bool)
- func (this_ *CmdService) Ttl(key string, args ...Arg) (res int64, err error)
- type Config
- type ConnProxy
- type CountArg
- type IService
- type KeysResult
- func ClusterKeys(ctx context.Context, client *redis.ClusterClient, database int, pattern string, ...) (keysResult *KeysResult, err error)
- func ClusterScan(ctx context.Context, client *redis.ClusterClient, database int, match string, ...) (keysResult *KeysResult, err error)
- func Keys(ctx context.Context, client redis.Cmdable, database int, pattern string, ...) (keysResult *KeysResult, err error)
- func Scan(ctx context.Context, client redis.Cmdable, database int, match string, ...) (keysResult *KeysResult, err error)
- type Locker
- type Param
- type SizeArg
- type StartArg
- type V8Service
- func (this_ *V8Service) Close()
- func (this_ *V8Service) DelPattern(pattern string, args ...Arg) (count int, err error)
- func (this_ *V8Service) GetClient(args ...Arg) (client redis.Cmdable, err error)
- func (this_ *V8Service) GetValueInfo(key string, args ...Arg) (valueInfo *ValueInfo, err error)
- func (this_ *V8Service) Keys(pattern string, args ...Arg) (keysResult *KeysResult, err error)
- func (this_ *V8Service) Scan(pattern string, args ...Arg) (keysResult *KeysResult, err error)
- func (this_ *V8Service) ValueType(key string, args ...Arg) (valueType string, err error)
- type ValueInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MemoryUsage ¶
Types ¶
type ClusterService ¶
type ClusterService struct {
*Config
*CmdService
// contains filtered or unexported fields
}
func (*ClusterService) Close ¶
func (this_ *ClusterService) Close()
func (*ClusterService) DelPattern ¶
func (this_ *ClusterService) DelPattern(pattern string, args ...Arg) (count int, err error)
func (*ClusterService) GetClient ¶
func (this_ *ClusterService) GetClient(args ...Arg) (client redis.Cmdable, err error)
func (*ClusterService) GetValueInfo ¶
func (this_ *ClusterService) GetValueInfo(key string, args ...Arg) (valueInfo *ValueInfo, err error)
func (*ClusterService) Keys ¶
func (this_ *ClusterService) Keys(pattern string, args ...Arg) (keysResult *KeysResult, err error)
func (*ClusterService) Scan ¶
func (this_ *ClusterService) Scan(pattern string, args ...Arg) (keysResult *KeysResult, err error)
type CmdService ¶
type CmdService struct {
ThrowNotFoundErr bool
GetClient func(param *Param) (client redis.Cmdable, err error) `json:"-"`
}
func (*CmdService) BitCount ¶
func (this_ *CmdService) BitCount(key string, args ...Arg) (count int64, err error)
func (*CmdService) Del ¶
func (this_ *CmdService) Del(key string, args ...Arg) (count int, err error)
func (*CmdService) Exists ¶
func (this_ *CmdService) Exists(key string, args ...Arg) (res int64, err error)
Exists key是否存在
func (*CmdService) Get ¶
func (this_ *CmdService) Get(key string, args ...Arg) (value string, err error)
func (*CmdService) HashDel ¶
func (this_ *CmdService) HashDel(key string, field string, args ...Arg) (err error)
func (*CmdService) HashGetAll ¶
func (*CmdService) IsNotFound ¶
func (this_ *CmdService) IsNotFound(err error) (res bool)
func (*CmdService) ListPush ¶
func (this_ *CmdService) ListPush(key string, value string, args ...Arg) (err error)
func (*CmdService) ListRPush ¶
func (this_ *CmdService) ListRPush(key string, value string, args ...Arg) (err error)
func (*CmdService) Persist ¶
func (this_ *CmdService) Persist(key string, args ...Arg) (res bool, err error)
Persist 移除键的过期时间
func (*CmdService) ScriptRun ¶
func (this_ *CmdService) ScriptRun(src string, KEYS []string, ARGV interface{}, args ...Arg) (value interface{}, err error)
func (*CmdService) Set ¶
func (this_ *CmdService) Set(key string, value string, args ...Arg) (err error)
func (*CmdService) SetAdd ¶
func (this_ *CmdService) SetAdd(key string, value string, args ...Arg) (err error)
func (*CmdService) SetCard ¶
func (this_ *CmdService) SetCard(key string, args ...Arg) (res int64, err error)
func (*CmdService) SetRem ¶
func (this_ *CmdService) SetRem(key string, value string, args ...Arg) (err error)
func (*CmdService) SetThrowNotFoundErr ¶
func (this_ *CmdService) SetThrowNotFoundErr(ThrowNotFoundErr bool)
type Config ¶
type Config struct {
// Disabled 禁用 上层 初始化服务时候 可以判断该属性 如果为 配置 true 则不去初始化服务
Disabled bool `json:"disabled,omitempty" yaml:"disabled,omitempty"`
Address string `json:"address" yaml:"address"`
Auth string `json:"auth" yaml:"auth"`
Username string `json:"username" yaml:"username"`
Database int `json:"database" yaml:"database"`
CertPath string `json:"certPath" yaml:"certPath"`
Servers []string `json:"servers" yaml:"servers"`
ThrowNotFoundErr bool `json:"throwNotFoundErr" yaml:"throwNotFoundErr"` // 是否 抛出 值 不存在异常
InsecureSkipVerify bool `json:"insecureSkipVerify" yaml:"insecureSkipVerify"` // TLS 跳过验证
// contains filtered or unexported fields
}
func (*Config) GetConnProxy ¶
func (*Config) SetConnProxy ¶
type IService ¶
type IService interface {
// Close 关闭 redis 客户端
Close()
// GetClient 获取 redis 指令客户端
GetClient(args ...Arg) (client redis.Cmdable, err error)
// Info 获取 redis 信息
Info(args ...Arg) (res string, err error)
// Keys 模糊 搜索 key,如 "xx*" 搜索
Keys(pattern string, args ...Arg) (keysResult *KeysResult, err error)
// Scan 模糊 搜索 key,如 "xx*" 搜索
Scan(pattern string, args ...Arg) (keysResult *KeysResult, err error)
// Expire 设置 key 过期时间 让给定键在指定的秒数之后过期
Expire(key string, expire int64, args ...Arg) (res bool, err error)
// Ttl 查看给定键距离过期还有多少秒
Ttl(key string, args ...Arg) (res int64, err error)
// Persist 移除键的过期时间
Persist(key string, args ...Arg) (res bool, err error)
// Exists 判断 key 是否存在
Exists(key string, args ...Arg) (res int64, err error)
ValueType(key string, args ...Arg) (valueType string, err error)
// GetValueInfo 获取 key 的值信息 string、set、list、hash等值 多个值的情况下 使用 StartArg 和 SizeArg 查询一定数量的值
GetValueInfo(key string, args ...Arg) (valueInfo *ValueInfo, err error)
// Get 获取 string 类型的值
Get(key string, args ...Arg) (value string, err error)
// Set 设置 string 类型的值
Set(key string, value string, args ...Arg) (err error)
Incr(key string, value int64, args ...Arg) (res int64, err error)
// SetAdd 在 set 中 添加 string 类型的值
SetAdd(key string, value string, args ...Arg) (err error)
// SetRem 在 set 中 移除 string 类型的值
SetRem(key string, value string, args ...Arg) (err error)
// SetCard 在 set 中 移除 string 类型的值
SetCard(key string, args ...Arg) (res int64, err error)
// ListPush 在 list 中 往 头部 追加 string 类型的值
ListPush(key string, value string, args ...Arg) (err error)
// ListRPush 在 list 中 往 尾部 追加 string 类型的值
ListRPush(key string, value string, args ...Arg) (err error)
// ListSet 在 list 中 往 某个 索引位 设置 string 类型的值
ListSet(key string, index int64, value string, args ...Arg) (err error)
// ListRem 在 list 中 根据参数 COUNT 的值,移除列表中与参数 VALUE 相等的元素 count > 0 : 从表头开始向表尾搜索,移除与 VALUE 相等的元素,数量为 COUNT count < 0 : 从表尾开始向表头搜索,移除与 VALUE 相等的元素,数量为 COUNT 的绝对值 count = 0 : 移除表中所有与 VALUE 相等的值
ListRem(key string, count int64, value string, args ...Arg) (err error)
// HashSet 在 hash 中 设置 字段 的值
HashSet(key string, field string, value string, args ...Arg) (err error)
// HashGet 在 hash 中 获取 字段 的值
HashGet(key string, field string, args ...Arg) (value string, err error)
// HashGetAll 在 hash 中 获取 所有 字段 的值
HashGetAll(key string, args ...Arg) (value map[string]string, err error)
// HashDel 在 hash 中 删除 字段 的值
HashDel(key string, field string, args ...Arg) (err error)
// Del 删除 某个 key
Del(key string, args ...Arg) (count int, err error)
// DelPattern 模糊删除 匹配 key
DelPattern(pattern string, args ...Arg) (count int, err error)
// BitSet 在 bitmap 中 设置 某个 位置的值
BitSet(key string, offset int64, value int, args ...Arg) (err error)
// BitCount 在 bitmap 中 统计 所有 值
BitCount(key string, args ...Arg) (count int64, err error)
ScriptRun(src string, KEYS []string, ARGV interface{}, args ...Arg) (value interface{}, err error)
SetThrowNotFoundErr(ThrowNotFoundErr bool)
IsNotFound(err error) (res bool)
}
func NewClusterService ¶
NewClusterService 创建集群客户端
type KeysResult ¶
type KeysResult struct {
Count int64 `json:"count"`
KeyList []string `json:"keyList"`
Database int `json:"database"`
}
func ClusterKeys ¶
func ClusterKeys(ctx context.Context, client *redis.ClusterClient, database int, pattern string, size int64) (keysResult *KeysResult, err error)
func ClusterScan ¶
func ClusterScan(ctx context.Context, client *redis.ClusterClient, database int, match string, size int64, count int64) (keysResult *KeysResult, err error)
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
type V8Service ¶
type V8Service struct {
*Config
*CmdService
// contains filtered or unexported fields
}
func (*V8Service) DelPattern ¶
func (*V8Service) GetValueInfo ¶
func (*V8Service) Keys ¶
func (this_ *V8Service) Keys(pattern string, args ...Arg) (keysResult *KeysResult, err error)
type ValueInfo ¶
type ValueInfo struct {
Database int `json:"database"`
Key string `json:"key"`
ValueType string `json:"valueType"`
Value interface{} `json:"value"`
ValueCount int64 `json:"valueCount"`
ValueStart int64 `json:"valueStart"`
ValueEnd int64 `json:"valueEnd"`
Cursor uint64 `json:"cursor"`
MemoryUsage int64 `json:"memoryUsage"`
TTL int64 `json:"ttl"`
}
Click to show internal directories.
Click to hide internal directories.