Documentation ¶
Index ¶
- Variables
- func New(list []map[string]any) map[string]*ClientRedis
- type ClientRedis
- func (c *ClientRedis) AddSet(key string, members ...interface{}) error
- func (c *ClientRedis) Close()
- func (c *ClientRedis) Get(key string) string
- func (c *ClientRedis) GetList(key string) []string
- func (c *ClientRedis) GetListIndex(key string, index int64) (list string)
- func (c *ClientRedis) GetListLength(key string) (lens int64)
- func (c *ClientRedis) GetSet(key string) ([]string, error)
- func (c *ClientRedis) GetSetLength(key string) (int64, error)
- func (c *ClientRedis) Ping() string
- func (c *ClientRedis) PushList(key string, value interface{}) error
- func (c *ClientRedis) Remove(key string) (int64, error)
- func (c *ClientRedis) RemoveList(key string, value interface{}, count ...int64) error
- func (c *ClientRedis) RemoveListLeft(key string) error
- func (c *ClientRedis) RemoveListRight(key string) error
- func (c *ClientRedis) SDiff(keys ...string) ([]string, error)
- func (c *ClientRedis) SInter(keys ...string) ([]string, error)
- func (c *ClientRedis) SIsMember(key string, member interface{}) (bool, error)
- func (c *ClientRedis) SPop(key string) (string, error)
- func (c *ClientRedis) SRandMember(key string) (string, error)
- func (c *ClientRedis) SRem(key string, members ...interface{}) (int64, error)
- func (c *ClientRedis) SUnion(keys ...string) ([]string, error)
- func (c *ClientRedis) Set(key string, value interface{}, expiration ...int64) error
- func (c *ClientRedis) SetExpiration(key string, expiration ...int64) error
- func (c *ClientRedis) SetList(key string, index int64, value interface{}) error
- func (c *ClientRedis) SetNX(key string, value interface{}, expiration ...int64) (result bool)
- func (c *ClientRedis) SetOptions(Options *redis.Options) *ClientRedis
- func (c *ClientRedis) TTL(key string) time.Duration
- func (c *ClientRedis) ZCard(key string) (int64, error)
- func (c *ClientRedis) ZCount(key, min, max string) (int64, error)
- func (c *ClientRedis) ZIncrBy(key string, increment float64, member string) (float64, error)
- func (c *ClientRedis) ZInterStore(destination string, store *redis.ZStore) (int64, error)
- func (c *ClientRedis) ZRange(key string, start, stop int64) ([]string, error)
- func (c *ClientRedis) ZRangeByScoreWithScores(key string, opt *redis.ZRangeBy) ([]redis.Z, error)
- func (c *ClientRedis) ZRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
- func (c *ClientRedis) ZRank(key string, member string) (int64, error)
- func (c *ClientRedis) ZRem(key string, members ...interface{}) (int64, error)
- func (c *ClientRedis) ZRemRangeByRank(key string, start, stop int64) (int64, error)
- func (c *ClientRedis) ZRemRangeByScore(key, min, max string) (int64, error)
- func (c *ClientRedis) ZRevRange(key string, start, stop int64) ([]string, error)
- func (c *ClientRedis) ZRevRangeByScoreWithScores(key string, opt *redis.ZRangeBy) ([]redis.Z, error)
- func (c *ClientRedis) ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
- func (c *ClientRedis) ZRevRank(key string, member string) (int64, error)
- func (c *ClientRedis) ZScore(key, member string) (float64, error)
- func (c *ClientRedis) ZSet(key string, members ...redis.Z) error
- func (c *ClientRedis) ZUnionStore(destination string, store *redis.ZStore) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var Client map[string]*ClientRedis
Functions ¶
Types ¶
type ClientRedis ¶ added in v1.5.2
type ClientRedis struct { Options redis.Options Clients *redis.Client Ctx context.Context ClusterClient *redis.ClusterClient Mode bool }
Client parameter structure
func NewClusterClient ¶
func NewClusterClient(Addrs []string, Password string) *ClientRedis
NewClusterClient <Redis集群>
func NewFailoverClient ¶
func NewFailoverClient(SentinelAddrs []string, MasterName, Password string, Db int) *ClientRedis
NewFailoverClient <Redis哨兵>
func (*ClientRedis) AddSet ¶ added in v1.5.2
func (c *ClientRedis) AddSet(key string, members ...interface{}) error
AddSet value<添加元素到集合>
func (*ClientRedis) GetList ¶ added in v1.5.2
func (c *ClientRedis) GetList(key string) []string
GetList value<获取列表>
func (*ClientRedis) GetListIndex ¶ added in v1.5.2
func (c *ClientRedis) GetListIndex(key string, index int64) (list string)
GetListIndex value<返回名称为key的list中index位置的元素>
func (*ClientRedis) GetListLength ¶ added in v1.5.2
func (c *ClientRedis) GetListLength(key string) (lens int64)
GetList value<获取列表长度>
func (*ClientRedis) GetSet ¶ added in v1.5.2
func (c *ClientRedis) GetSet(key string) ([]string, error)
GetSet value<获取集合的所有成员>
func (*ClientRedis) GetSetLength ¶ added in v1.5.2
func (c *ClientRedis) GetSetLength(key string) (int64, error)
GetSetLength value<获取集合长度>
func (*ClientRedis) PushList ¶ added in v1.5.2
func (c *ClientRedis) PushList(key string, value interface{}) error
PushList value<添加>
func (*ClientRedis) Remove ¶ added in v1.5.2
func (c *ClientRedis) Remove(key string) (int64, error)
Remove value<删除数据>
func (*ClientRedis) RemoveList ¶ added in v1.5.2
func (c *ClientRedis) RemoveList(key string, value interface{}, count ...int64) error
RemoveList value<删除列表> count 参数表示删除多少个key中的list
func (*ClientRedis) RemoveListLeft ¶ added in v1.5.2
func (c *ClientRedis) RemoveListLeft(key string) error
RemoveListLeft value<返回并删除名称为key的list中的首元素>
func (*ClientRedis) RemoveListRight ¶ added in v1.5.2
func (c *ClientRedis) RemoveListRight(key string) error
RemoveListRight value<返回并删除名称为key的list中的尾元素>
func (*ClientRedis) SDiff ¶ added in v1.5.8
func (c *ClientRedis) SDiff(keys ...string) ([]string, error)
SDiff value<计算多个集合的差集>
func (*ClientRedis) SInter ¶ added in v1.5.8
func (c *ClientRedis) SInter(keys ...string) ([]string, error)
SInter value<计算多个集合的交集>
func (*ClientRedis) SIsMember ¶ added in v1.5.8
func (c *ClientRedis) SIsMember(key string, member interface{}) (bool, error)
SIsMember value<检查元素是否存在>
func (*ClientRedis) SPop ¶ added in v1.5.8
func (c *ClientRedis) SPop(key string) (string, error)
SPop value<移除并返回集合中的一个随机元素>
func (*ClientRedis) SRandMember ¶ added in v1.5.8
func (c *ClientRedis) SRandMember(key string) (string, error)
SRandMember value<随机获取集合的一个成员>
func (*ClientRedis) SRem ¶ added in v1.5.8
func (c *ClientRedis) SRem(key string, members ...interface{}) (int64, error)
SRem value<移除元素>
func (*ClientRedis) SUnion ¶ added in v1.5.8
func (c *ClientRedis) SUnion(keys ...string) ([]string, error)
SUnion value<计算多个集合的并集>
func (*ClientRedis) Set ¶ added in v1.5.2
func (c *ClientRedis) Set(key string, value interface{}, expiration ...int64) error
Set value<设置读写> expiration<毫秒>
func (*ClientRedis) SetExpiration ¶ added in v1.5.8
func (c *ClientRedis) SetExpiration(key string, expiration ...int64) error
SetExpiration 设置过期时间 SetExpiration<毫秒>
func (*ClientRedis) SetList ¶ added in v1.5.2
func (c *ClientRedis) SetList(key string, index int64, value interface{}) error
SetList value<修改列表>
func (*ClientRedis) SetNX ¶ added in v1.5.2
func (c *ClientRedis) SetNX(key string, value interface{}, expiration ...int64) (result bool)
SetNX value<不存在才设置> expiration<毫秒>
func (*ClientRedis) SetOptions ¶ added in v1.5.2
func (c *ClientRedis) SetOptions(Options *redis.Options) *ClientRedis
SetOptions <修改配置>
func (*ClientRedis) TTL ¶ added in v1.5.2
func (c *ClientRedis) TTL(key string) time.Duration
TTL<获取过期时间>
func (*ClientRedis) ZCard ¶ added in v1.5.8
func (c *ClientRedis) ZCard(key string) (int64, error)
ZCard 获取有序集合的元素数量
func (*ClientRedis) ZCount ¶ added in v1.5.8
func (c *ClientRedis) ZCount(key, min, max string) (int64, error)
ZCount 获取有序集合指定分数范围内的成员数量
func (*ClientRedis) ZInterStore ¶ added in v1.5.8
func (c *ClientRedis) ZInterStore(destination string, store *redis.ZStore) (int64, error)
ZInterStore 计算多个有序集合的交集,并存储到新的有序集合中
func (*ClientRedis) ZRange ¶ added in v1.5.8
func (c *ClientRedis) ZRange(key string, start, stop int64) ([]string, error)
ZRange 返回集合中某个索引范围的元素,根据分数从小到大排序
func (*ClientRedis) ZRangeByScoreWithScores ¶ added in v1.5.9
func (c *ClientRedis) ZRangeByScoreWithScores(key string, opt *redis.ZRangeBy) ([]redis.Z, error)
ZRangeByScoreWithScores 根据opt条件升序查询
func (*ClientRedis) ZRangeWithScores ¶ added in v1.5.8
func (c *ClientRedis) ZRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
ZRangeWithScores 获取有序集合指定排名范围内的成员及其分数
func (*ClientRedis) ZRank ¶ added in v1.5.8
func (c *ClientRedis) ZRank(key string, member string) (int64, error)
ZRevRank 获取有序集合中指定成员的排名(从低到高)
func (*ClientRedis) ZRem ¶ added in v1.5.8
func (c *ClientRedis) ZRem(key string, members ...interface{}) (int64, error)
ZRem 删除有序集合中的指定成
func (*ClientRedis) ZRemRangeByRank ¶ added in v1.5.8
func (c *ClientRedis) ZRemRangeByRank(key string, start, stop int64) (int64, error)
ZRemRangeByRank 按照排名范围删除有序集合中的成员
func (*ClientRedis) ZRemRangeByScore ¶ added in v1.5.8
func (c *ClientRedis) ZRemRangeByScore(key, min, max string) (int64, error)
ZIncrBy 照分数范围删除有序集合中的成员
func (*ClientRedis) ZRevRange ¶ added in v1.5.8
func (c *ClientRedis) ZRevRange(key string, start, stop int64) ([]string, error)
ZRevRange 返回集合中某个索引范围的元素,根据分数从小到大排序
func (*ClientRedis) ZRevRangeByScoreWithScores ¶ added in v1.5.9
func (c *ClientRedis) ZRevRangeByScoreWithScores(key string, opt *redis.ZRangeBy) ([]redis.Z, error)
ZRevRangeByScoreWithScores 根据opt条件降序查询
func (*ClientRedis) ZRevRangeWithScores ¶ added in v1.5.8
func (c *ClientRedis) ZRevRangeWithScores(key string, start, stop int64) ([]redis.Z, error)
ZIncrBy 获取有序集合中指定排名范围内的成员列表及其分数
func (*ClientRedis) ZRevRank ¶ added in v1.5.8
func (c *ClientRedis) ZRevRank(key string, member string) (int64, error)
ZRevRank 获取有序集合中指定成员的排名(从高到低)
func (*ClientRedis) ZScore ¶ added in v1.5.8
func (c *ClientRedis) ZScore(key, member string) (float64, error)
ZCard 获取有序集合指定成员的分数
func (*ClientRedis) ZSet ¶ added in v1.5.8
func (c *ClientRedis) ZSet(key string, members ...redis.Z) error
ZSet 有序集合add
func (*ClientRedis) ZUnionStore ¶ added in v1.5.8
func (c *ClientRedis) ZUnionStore(destination string, store *redis.ZStore) (int64, error)
ZUnionStore 计算多个有序集合的并集,并存储到新的有序集合中