Documentation ¶
Index ¶
- Constants
- func Key(key string) string
- func NewPool(clusterConf []*config.Cluster)
- func Slot(key string) int
- type Client
- func (c *Client) ClusterInfo(ctx context.Context) (string, error)
- func (c *Client) ClusterNodes(ctx context.Context) (string, error)
- func (c *Client) Del(ctx context.Context, keys ...string) (int64, error)
- func (c *Client) Exists(ctx context.Context, key ...string) (int64, error)
- func (c *Client) Expire(ctx context.Context, key string, expiration time.Duration) (bool, error)
- func (c *Client) Forget(ctx context.Context, nodeID string) (string, error)
- func (c *Client) Get(ctx context.Context, key string) (string, error)
- func (c *Client) GetSet(ctx context.Context, key string, value interface{}) (string, error)
- func (c *Client) HDel(ctx context.Context, key string, fields ...string) (int64, error)
- func (c *Client) HDelWithBatch(ctx context.Context, reqs []*MHDelreq) (res int64, err error)
- func (c *Client) HExists(ctx context.Context, key string, field string) (res bool, err error)
- func (c *Client) HGet(ctx context.Context, key, field string) (string, error)
- func (c *Client) HGetAll(ctx context.Context, key string) (map[string]string, error)
- func (c *Client) HIncrBy(ctx context.Context, key string, field string, inrc int64) (res int64, err error)
- func (c *Client) HIncrByFloat(ctx context.Context, key string, field string, inrc float64) (res float64, err error)
- func (c *Client) HIncrByWithBatch(ctx context.Context, reqs []*MHIncrByReq) (res int64, err error)
- func (c *Client) HKeys(ctx context.Context, key string) (res []string, err error)
- func (c *Client) HMGet(ctx context.Context, key string, fields ...string) (map[string]interface{}, error)
- func (c *Client) HMSet(ctx context.Context, key string, fields map[string]interface{}) (bool, error)
- func (c *Client) HMSetWithBatch(ctx context.Context, reqs []*HMSetReq) (res string, err error)
- func (c *Client) HSet(ctx context.Context, key, field string, value interface{}) (int64, error)
- func (c *Client) HSetNX(ctx context.Context, key, field string, value interface{}) (bool, error)
- func (c *Client) HSetNXWithBatch(ctx context.Context, keys []string, field string, value interface{}) (bool, error)
- func (c *Client) HSetWithBatch(ctx context.Context, keys []string, field string, value interface{}) (int64, error)
- func (c *Client) HVals(ctx context.Context, key string) (res []string, err error)
- func (c *Client) Info(ctx context.Context, section ...string) (res map[string]string, err error)
- func (c *Client) Keys(ctx context.Context, key string) ([]string, error)
- func (c *Client) LIndex(ctx context.Context, key string, index int64) (string, error)
- func (c *Client) LInsert(ctx context.Context, key, op string, pivot, value interface{}) (int64, error)
- func (c *Client) LLen(ctx context.Context, key string) (int64, error)
- func (c *Client) LPop(ctx context.Context, key string) (string, error)
- func (c *Client) LPush(ctx context.Context, expiration time.Duration, key string, ...) (res int64, err error)
- func (c *Client) LRange(ctx context.Context, key string, start, stop int64) ([]string, error)
- func (c *Client) LSet(ctx context.Context, key string, index int64, value interface{}) (string, error)
- func (c *Client) LTrim(ctx context.Context, key string, start, stop int64) (string, error)
- func (c *Client) MExpire(ctx context.Context, reqs []*MExpireReq) (bool, error)
- func (c *Client) MGet(ctx context.Context, keys ...string) ([]*KeyValue, error)
- func (c *Client) MHIncrByFloatWithBatch(ctx context.Context, reqs []*MHIncrByFloatReq) (res float64, err error)
- func (c *Client) MLInsert(ctx context.Context, reqs []*MLInsertReq) (res int64, err error)
- func (c *Client) MLLen(ctx context.Context, keys ...string) (map[string]int64, error)
- func (c *Client) MLPop(ctx context.Context, keys ...string) (res string, err error)
- func (c *Client) MLPush(ctx context.Context, reqs []*MLPushReq) (res int64, err error)
- func (c *Client) MLSet(ctx context.Context, reqs []*MLSetReq) (res string, err error)
- func (c *Client) MRPop(ctx context.Context, keys ...string) (res string, err error)
- func (c *Client) MRPush(ctx context.Context, reqs []*MRPushReq) (res int64, err error)
- func (c *Client) MSAdd(ctx context.Context, reqs []*MSAddReq) (int64, error)
- func (c *Client) MSRem(ctx context.Context, reqs []*MSRemReq) (int64, error)
- func (c *Client) MSet(ctx context.Context, req ...*MSetReq) (string, error)
- func (c *Client) MZAdd(ctx context.Context, reqs []*MZAddReq) (int64, error)
- func (c *Client) MZIncrBy(ctx context.Context, reqs []*MZIncrByReq) (float64, error)
- func (c *Client) MZRem(ctx context.Context, reqs []*MZRemReq) (int64, error)
- func (c *Client) MZRemRangeByRank(ctx context.Context, reqs []*MZRemRangeByRankReq) (int64, error)
- func (c *Client) MZRemRangeByScore(ctx context.Context, reqs []*MZRemRangeByScoreReq) (int64, error)
- func (c *Client) NodeInfo(ctx context.Context, addr string, section ...string) (res string, err error)
- func (c *Client) RPop(ctx context.Context, key string) (string, error)
- func (c *Client) RPush(ctx context.Context, expiration time.Duration, key string, ...) (res int64, err error)
- func (c *Client) SAdd(ctx context.Context, key string, members ...interface{}) (int64, error)
- func (c *Client) SCard(ctx context.Context, key string) (int64, error)
- func (c *Client) SIsMember(ctx context.Context, key string, member interface{}) (bool, error)
- func (c *Client) SMembers(ctx context.Context, key string) ([]string, error)
- func (c *Client) SPop(ctx context.Context, key string) (string, error)
- func (c *Client) SRandMember(ctx context.Context, key string) (string, error)
- func (c *Client) SRandMemberN(ctx context.Context, key string, n int64) ([]string, error)
- func (c *Client) SRem(ctx context.Context, key string, member ...interface{}) (int64, error)
- func (c *Client) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) (string, error)
- func (c *Client) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)
- func (c *Client) SetNXWithKeys(ctx context.Context, keys []string, value interface{}, ...) (bool, error)
- func (c *Client) SetWithKeys(ctx context.Context, keys []string, value interface{}, ...) (string, error)
- func (c *Client) TTL(ctx context.Context, key string) (time.Duration, error)
- func (c *Client) ZAdd(ctx context.Context, key string, member ...Z) (int64, error)
- func (c *Client) ZCard(ctx context.Context, key string) (int64, error)
- func (c *Client) ZCount(ctx context.Context, key, min, max string) (int64, error)
- func (c *Client) ZIncrBy(ctx context.Context, key string, increment float64, member string) (float64, error)
- func (c *Client) ZRange(ctx context.Context, key string, start, stop int64) ([]string, error)
- func (c *Client) ZRangeByScore(ctx context.Context, key, min, max string, offset, count int64) ([]string, error)
- func (c *Client) ZRangeByScoreWithScores(ctx context.Context, key, min, max string, offset, count int64) ([]*Z, error)
- func (c *Client) ZRangeWithScores(ctx context.Context, key string, start, stop int64) ([]*Z, error)
- func (c *Client) ZRem(ctx context.Context, key string, members ...interface{}) (int64, error)
- func (c *Client) ZRemRangeByRank(ctx context.Context, key string, start, stop int64) (int64, error)
- func (c *Client) ZRemRangeByScore(ctx context.Context, key string, min, max string) (int64, error)
- func (c *Client) ZRevRange(ctx context.Context, key string, start, stop int64) ([]string, error)
- func (c *Client) ZRevRangeByScore(ctx context.Context, key, min, max string, offset, count int64) ([]string, error)
- func (c *Client) ZRevRangeByScoreWithScores(ctx context.Context, key, min, max string, offset, count int64) ([]*Z, error)
- func (c *Client) ZRevRangeWithScores(ctx context.Context, key string, start, stop int64) ([]*Z, error)
- func (c *Client) ZScore(ctx context.Context, key, member string) (float64, error)
- type HMSetReq
- type KeyValue
- type MExpireReq
- type MHDelreq
- type MHIncrByFloatReq
- type MHIncrByReq
- type MLInsertReq
- type MLPushReq
- type MLSetReq
- type MRPushReq
- type MSAddReq
- type MSRemReq
- type MSetReq
- type MZAddReq
- type MZIncrByReq
- type MZRemRangeByRankReq
- type MZRemRangeByScoreReq
- type MZRemReq
- type Z
Constants ¶
const SlotNumber = 16384
SlotNumber the number of slot
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct { Clusters []*redis.ClusterClient //集群 W int //写成功数 R int //读成功数 WriteTimeout time.Duration //总写时延 ReadTimeout time.Duration //总读时延 }
Client 线程池类型
func (*Client) ClusterInfo ¶
ClusterInfo 获取集群信息
func (*Client) ClusterNodes ¶
ClusterNodes 获取
func (*Client) HDelWithBatch ¶
HDelWithBatch 批量HDel
func (*Client) HIncrBy ¶
func (c *Client) HIncrBy(ctx context.Context, key string, field string, inrc int64) (res int64, err error)
HIncrBy field中的值增加inrc
func (*Client) HIncrByFloat ¶
func (c *Client) HIncrByFloat(ctx context.Context, key string, field string, inrc float64) (res float64, err error)
HIncrByFloat HIncrBy 的float版
func (*Client) HIncrByWithBatch ¶
HIncrByWithBatch 批量 HIncrBy
func (*Client) HMGet ¶
func (c *Client) HMGet(ctx context.Context, key string, fields ...string) (map[string]interface{}, error)
HMGet 批量获取Hash table
func (*Client) HMSet ¶
func (c *Client) HMSet(ctx context.Context, key string, fields map[string]interface{}) (bool, error)
HMSet 批量HSet
func (*Client) HMSetWithBatch ¶
HMSetWithBatch 批量HMSet
func (*Client) HSetNXWithBatch ¶
func (c *Client) HSetNXWithBatch(ctx context.Context, keys []string, field string, value interface{}) (bool, error)
HSetWithBatch 批量插入多个key
func (*Client) HSetWithBatch ¶
func (c *Client) HSetWithBatch(ctx context.Context, keys []string, field string, value interface{}) (int64, error)
HSetWithBatch 批量插入多个key
func (*Client) LInsert ¶
func (c *Client) LInsert(ctx context.Context, key, op string, pivot, value interface{}) (int64, error)
LInsert 将值 value 插入到列表 key 当中,位于值 pivot 之前或之后。
func (*Client) LPush ¶
func (c *Client) LPush(ctx context.Context, expiration time.Duration, key string, value ...interface{}) (res int64, err error)
LPush 把value 插到表头
func (*Client) LSet ¶
func (c *Client) LSet(ctx context.Context, key string, index int64, value interface{}) (string, error)
LSet 设置表中index 的值为 value
func (*Client) MHIncrByFloatWithBatch ¶
func (c *Client) MHIncrByFloatWithBatch(ctx context.Context, reqs []*MHIncrByFloatReq) (res float64, err error)
MHIncrByFloatWithBatch HIncrByWithBatch float版
func (*Client) MZRemRangeByRank ¶
MZRemRangeByRank 按照排序批量移除多个有序集成员
func (*Client) MZRemRangeByScore ¶
func (c *Client) MZRemRangeByScore(ctx context.Context, reqs []*MZRemRangeByScoreReq) (int64, error)
MZRemRangeByScore 按照score,批量移除多个有序集成员
func (*Client) NodeInfo ¶
func (c *Client) NodeInfo(ctx context.Context, addr string, section ...string) (res string, err error)
NodeInfo 获取单个节点的info
func (*Client) RPush ¶
func (c *Client) RPush(ctx context.Context, expiration time.Duration, key string, value ...interface{}) (res int64, err error)
RPush 把value 插到表头
func (*Client) SRandMember ¶
SRandMember 随机返回set中一个元素
func (*Client) SRandMemberN ¶
SRandMemberN 随机返回set中N个元素
func (*Client) Set ¶
func (c *Client) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) (string, error)
Set 对于Set
func (*Client) SetNX ¶
func (c *Client) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) (bool, error)
对于SetNX 的包装
func (*Client) SetNXWithKeys ¶
func (c *Client) SetNXWithKeys(ctx context.Context, keys []string, value interface{}, expiration time.Duration) (bool, error)
Sets 对于Set和SetNX 的包装
func (*Client) SetWithKeys ¶
func (*Client) ZCount ¶
ZCount 返回score在min, max 中的数量 ,默认闭区间开一在min和max前添加 ( 来使用开区间,min 和 max 可以是 -inf 和 +inf
func (*Client) ZIncrBy ¶
func (c *Client) ZIncrBy(ctx context.Context, key string, increment float64, member string) (float64, error)
ZIncrBy 为有序集 key 的成员 member 的 score 值加上增量 increment
func (*Client) ZRange ¶
ZRange 返回有序集 key 中,指定区间内的成员,从小到大, 下标参数 start 和 stop 都以 0 为底,也就是说,以 0 表示有序集第一个成员,以 1 表示有序集第二个成员,以此类推。 你也可以使用负数下标,以 -1 表示最后一个成员, -2 表示倒数第二个成员,以此类推。
func (*Client) ZRangeByScore ¶
func (c *Client) ZRangeByScore(ctx context.Context, key, min, max string, offset, count int64) ([]string, error)
ZRangeByScore 返回有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员。有序集成员按 score 值递增(从小到大)次序排列。
func (*Client) ZRangeByScoreWithScores ¶
func (c *Client) ZRangeByScoreWithScores(ctx context.Context, key, min, max string, offset, count int64) ([]*Z, error)
ZRangeByScoreWithScores 返回有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员。有序集成员按 score 值递增(从小到大)次序排列(带score)。
func (*Client) ZRangeWithScores ¶
ZRangeWithScores 返回有序集 key 中,指定区间内的成员(带score), 从小到大
func (*Client) ZRemRangeByRank ¶
ZRemRangeByRank 移除有序集 key 中,指定排名(rank)区间内的所有成员
func (*Client) ZRemRangeByScore ¶
ZRemRangeByScore 移除有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员。
func (*Client) ZRevRange ¶
ZRevRange 返回有序集 key 中,指定区间内的成员,从大到小 下标参数 start 和 stop 都以 0 为底,也就是说,以 0 表示有序集第一个成员,以 1 表示有序集第二个成员,以此类推。 你也可以使用负数下标,以 -1 表示最后一个成员, -2 表示倒数第二个成员,以此类推。
func (*Client) ZRevRangeByScore ¶
func (c *Client) ZRevRangeByScore(ctx context.Context, key, min, max string, offset, count int64) ([]string, error)
ZRevRangeByScore 返回有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员。有序集成员按 score 值递增(从小到大)次序排列。
func (*Client) ZRevRangeByScoreWithScores ¶
func (c *Client) ZRevRangeByScoreWithScores(ctx context.Context, key, min, max string, offset, count int64) ([]*Z, error)
ZRevRangeByScoreWithScores 返回有序集 key 中,所有 score 值介于 min 和 max 之间(包括等于 min 或 max )的成员。有序集成员按 score 值递增(从小到大)次序排列(带score)。
type MExpireReq ¶
MExpireReq 批量设置过期时间参数
type MHIncrByFloatReq ¶
MHIncrByFloatReq MHIncrByReq float版
type MHIncrByReq ¶
MHIncrByReq 批量 HIncrBy 参数
type MLInsertReq ¶
MLInsertReq 批量 LInsert参数
type MZIncrByReq ¶
MZIncrByReq 批量为有序集 key 的成员 member 的 score 值加上增量 increment 参数
type MZRemRangeByRankReq ¶
MZRemRangeByRankReq 按照排序批量移除多个有序集成员的参数
type MZRemRangeByScoreReq ¶
MZRemRangeByScoreReq 按照score,批量移除多个有序集成员参数,