Documentation
¶
Overview ¶
Package redis implements a Redis client.
Example (CustomCommand) ¶
Get := func(ctx context.Context, rdb *redis.Client, key string) *redis.StringCmd {
cmd := redis.NewStringCmd(ctx, "get", key)
rdb.Process(ctx, cmd)
return cmd
}
v, err := Get(ctx, rdb, "key_does_not_exist").Result()
fmt.Printf("%q %s", v, err)
Output: "" redis: nil
Example (CustomCommand2) ¶
v, err := rdb.Do(ctx, "get", "key_does_not_exist").Text()
fmt.Printf("%q %s", v, err)
Output: "" redis: nil
Example (Instrumentation) ¶
rdb := redis.NewClient(&redis.Options{
Addr: ":6379",
})
rdb.AddHook(redisHook{})
rdb.Ping(ctx)
Output: starting processing: <ping: > finished processing: <ping: PONG>
Index ¶
- Constants
- Variables
- func SetLogger(logger internal.Logging)
- func Version() string
- type BitCount
- type BoolCmd
- type BoolSliceCmd
- func (cmd *BoolSliceCmd) Args() []interface{}
- func (cmd *BoolSliceCmd) Err() error
- func (cmd *BoolSliceCmd) FullName() string
- func (cmd *BoolSliceCmd) Name() string
- func (cmd *BoolSliceCmd) Result() ([]bool, error)
- func (cmd *BoolSliceCmd) SetErr(e error)
- func (cmd *BoolSliceCmd) String() string
- func (cmd *BoolSliceCmd) Val() []bool
- type ChannelOption
- type Client
- func (hs *Client) AddHook(hook Hook)
- func (c Client) Append(context interface{}, key, value string) *IntCmd
- func (c Client) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Client) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Client) BRPopLPush(context interface{}, source, destination string, timeout time.Duration) *StringCmd
- func (c Client) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Client) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Client) BgRewriteAOF(context interface{}) *StatusCmd
- func (c Client) BgSave(context interface{}) *StatusCmd
- func (c Client) BitCount(context interface{}, key string, bitCount *BitCount) *IntCmd
- func (c Client) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
- func (c Client) BitOpAnd(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Client) BitOpNot(context interface{}, destKey string, key string) *IntCmd
- func (c Client) BitOpOr(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Client) BitOpXor(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Client) BitPos(context interface{}, key string, bit int64, pos ...int64) *IntCmd
- func (c Client) ClientGetName(context interface{}) *StringCmd
- func (c Client) ClientID(context interface{}) *IntCmd
- func (c Client) ClientKill(context interface{}, ipPort string) *StatusCmd
- func (c Client) ClientKillByFilter(context interface{}, keys ...string) *IntCmd
- func (c Client) ClientList(context interface{}) *StringCmd
- func (c Client) ClientPause(context interface{}, dur time.Duration) *BoolCmd
- func (c Client) ClientUnblock(context interface{}, id int64) *IntCmd
- func (c Client) ClientUnblockWithError(context interface{}, id int64) *IntCmd
- func (c Client) Close() error
- func (c Client) ClusterAddSlots(context interface{}, slots ...int) *StatusCmd
- func (c Client) ClusterAddSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Client) ClusterCountFailureReports(context interface{}, nodeID string) *IntCmd
- func (c Client) ClusterCountKeysInSlot(context interface{}, slot int) *IntCmd
- func (c Client) ClusterDelSlots(context interface{}, slots ...int) *StatusCmd
- func (c Client) ClusterDelSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Client) ClusterFailover(context interface{}) *StatusCmd
- func (c Client) ClusterForget(context interface{}, nodeID string) *StatusCmd
- func (c Client) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
- func (c Client) ClusterInfo(context interface{}) *StringCmd
- func (c Client) ClusterKeySlot(context interface{}, key string) *IntCmd
- func (c Client) ClusterMeet(context interface{}, host, port string) *StatusCmd
- func (c Client) ClusterNodes(context interface{}) *StringCmd
- func (c Client) ClusterReplicate(context interface{}, nodeID string) *StatusCmd
- func (c Client) ClusterResetHard(context interface{}) *StatusCmd
- func (c Client) ClusterResetSoft(context interface{}) *StatusCmd
- func (c Client) ClusterSaveConfig(context interface{}) *StatusCmd
- func (c Client) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
- func (c Client) ClusterSlots(context interface{}) *ClusterSlotsCmd
- func (c Client) Command(context interface{}) *CommandsInfoCmd
- func (c Client) ConfigGet(context interface{}, parameter string) *SliceCmd
- func (c Client) ConfigResetStat(context interface{}) *StatusCmd
- func (c Client) ConfigRewrite(context interface{}) *StatusCmd
- func (c Client) ConfigSet(context interface{}, parameter, value string) *StatusCmd
- func (c *Client) Conn(ctx context.Context) *Conn
- func (c *Client) Context() context.Context
- func (c Client) DBSize(context interface{}) *IntCmd
- func (c Client) DebugObject(context interface{}, key string) *StringCmd
- func (c Client) Decr(context interface{}, key string) *IntCmd
- func (c Client) DecrBy(context interface{}, key string, decrement int64) *IntCmd
- func (c Client) Del(context interface{}, keys ...string) *IntCmd
- func (c *Client) Do(ctx context.Context, args ...interface{}) *Cmd
- func (c Client) Dump(context interface{}, key string) *StringCmd
- func (c Client) Echo(context interface{}, message interface{}) *StringCmd
- func (c Client) Eval(context interface{}, script string, keys []string, args ...interface{}) *Cmd
- func (c Client) EvalSha(context interface{}, sha1 string, keys []string, args ...interface{}) *Cmd
- func (c Client) Exists(context interface{}, keys ...string) *IntCmd
- func (c Client) Expire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Client) ExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Client) FlushAll(context interface{}) *StatusCmd
- func (c Client) FlushAllAsync(context interface{}) *StatusCmd
- func (c Client) FlushDB(context interface{}) *StatusCmd
- func (c Client) FlushDBAsync(context interface{}) *StatusCmd
- func (c Client) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Client) GeoDist(context interface{}, key string, member1, member2, unit string) *FloatCmd
- func (c Client) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
- func (c Client) GeoPos(context interface{}, key string, members ...string) *GeoPosCmd
- func (c Client) GeoRadius(context interface{}, key string, longitude, latitude float64, ...) *GeoLocationCmd
- func (c Client) GeoRadiusByMember(context interface{}, key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Client) GeoRadiusByMemberStore(context interface{}, key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Client) GeoRadiusStore(context interface{}, key string, longitude, latitude float64, ...) *IntCmd
- func (c Client) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
- func (c Client) GeoSearchLocation(context interface{}, key string, q *GeoSearchLocationQuery) *GeoSearchLocationCmd
- func (c Client) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
- func (c Client) Get(context interface{}, key string) *StringCmd
- func (c Client) GetBit(context interface{}, key string, offset int64) *IntCmd
- func (c Client) GetDel(context interface{}, key string) *StringCmd
- func (c Client) GetEx(context interface{}, key string, expiration time.Duration) *StringCmd
- func (c Client) GetRange(context interface{}, key string, start, end int64) *StringCmd
- func (c Client) GetSet(context interface{}, key string, value interface{}) *StringCmd
- func (c Client) HDel(context interface{}, key string, fields ...string) *IntCmd
- func (c Client) HExists(context interface{}, key, field string) *BoolCmd
- func (c Client) HGet(context interface{}, key, field string) *StringCmd
- func (c Client) HGetAll(context interface{}, key string) *StringStringMapCmd
- func (c Client) HIncrBy(context interface{}, key, field string, incr int64) *IntCmd
- func (c Client) HIncrByFloat(context interface{}, key, field string, incr float64) *FloatCmd
- func (c Client) HKeys(context interface{}, key string) *StringSliceCmd
- func (c Client) HLen(context interface{}, key string) *IntCmd
- func (c Client) HMGet(context interface{}, key string, fields ...string) *SliceCmd
- func (c Client) HMSet(context interface{}, key string, values ...interface{}) *BoolCmd
- func (c Client) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
- func (c Client) HScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Client) HSet(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Client) HSetNX(context interface{}, key, field string, value interface{}) *BoolCmd
- func (c Client) HVals(context interface{}, key string) *StringSliceCmd
- func (c Client) Incr(context interface{}, key string) *IntCmd
- func (c Client) IncrBy(context interface{}, key string, value int64) *IntCmd
- func (c Client) IncrByFloat(context interface{}, key string, value float64) *FloatCmd
- func (c Client) Info(context interface{}, section ...string) *StringCmd
- func (c Client) Keys(context interface{}, pattern string) *StringSliceCmd
- func (c Client) LIndex(context interface{}, key string, index int64) *StringCmd
- func (c Client) LInsert(context interface{}, key, op string, pivot, value interface{}) *IntCmd
- func (c Client) LInsertAfter(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Client) LInsertBefore(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Client) LLen(context interface{}, key string) *IntCmd
- func (c Client) LMove(context interface{}, source, destination, srcpos, destpos string) *StringCmd
- func (c Client) LPop(context interface{}, key string) *StringCmd
- func (c Client) LPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Client) LPos(context interface{}, key string, value string, a LPosArgs) *IntCmd
- func (c Client) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
- func (c Client) LPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Client) LPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Client) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Client) LRem(context interface{}, key string, count int64, value interface{}) *IntCmd
- func (c Client) LSet(context interface{}, key string, index int64, value interface{}) *StatusCmd
- func (c Client) LTrim(context interface{}, key string, start, stop int64) *StatusCmd
- func (c Client) LastSave(context interface{}) *IntCmd
- func (c Client) MGet(context interface{}, keys ...string) *SliceCmd
- func (c Client) MSet(context interface{}, values ...interface{}) *StatusCmd
- func (c Client) MSetNX(context interface{}, values ...interface{}) *BoolCmd
- func (c Client) MemoryUsage(context interface{}, key string, samples ...int) *IntCmd
- func (c Client) Migrate(context interface{}, host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Client) Move(context interface{}, key string, db int) *BoolCmd
- func (c Client) ObjectEncoding(context interface{}, key string) *StringCmd
- func (c Client) ObjectIdleTime(context interface{}, key string) *DurationCmd
- func (c Client) ObjectRefCount(context interface{}, key string) *IntCmd
- func (c *Client) Options() *Options
- func (c Client) PExpire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Client) PExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Client) PFAdd(context interface{}, key string, els ...interface{}) *IntCmd
- func (c Client) PFCount(context interface{}, keys ...string) *IntCmd
- func (c Client) PFMerge(context interface{}, dest string, keys ...string) *StatusCmd
- func (c *Client) PSubscribe(ctx context.Context, channels ...string) *PubSub
- func (c Client) PTTL(context interface{}, key string) *DurationCmd
- func (c Client) Persist(context interface{}, key string) *BoolCmd
- func (c Client) Ping(context interface{}) *StatusCmd
- func (c *Client) Pipeline() Pipeliner
- func (c *Client) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Client) PoolStats() *PoolStats
- func (c *Client) Process(ctx context.Context, cmd Cmder) error
- func (c Client) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
- func (c Client) PubSubNumPat(context interface{}) *IntCmd
- func (c Client) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
- func (c Client) Publish(context interface{}, channel string, message interface{}) *IntCmd
- func (c Client) Quit(ctx interface{}) *StatusCmd
- func (c Client) RPop(context interface{}, key string) *StringCmd
- func (c Client) RPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Client) RPopLPush(context interface{}, source, destination string) *StringCmd
- func (c Client) RPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Client) RPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Client) RandomKey(context interface{}) *StringCmd
- func (c Client) ReadOnly(context interface{}) *StatusCmd
- func (c Client) ReadWrite(context interface{}) *StatusCmd
- func (c Client) Rename(context interface{}, key, newkey string) *StatusCmd
- func (c Client) RenameNX(context interface{}, key, newkey string) *BoolCmd
- func (c Client) Restore(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Client) RestoreReplace(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Client) SAdd(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Client) SCard(context interface{}, key string) *IntCmd
- func (c Client) SDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Client) SDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Client) SInter(context interface{}, keys ...string) *StringSliceCmd
- func (c Client) SInterStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Client) SIsMember(context interface{}, key string, member interface{}) *BoolCmd
- func (c Client) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
- func (c Client) SMembers(context interface{}, key string) *StringSliceCmd
- func (c Client) SMembersMap(context interface{}, key string) *StringStructMapCmd
- func (c Client) SMove(context interface{}, source, destination string, member interface{}) *BoolCmd
- func (c Client) SPop(context interface{}, key string) *StringCmd
- func (c Client) SPopN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Client) SRandMember(context interface{}, key string) *StringCmd
- func (c Client) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Client) SRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Client) SScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Client) SUnion(context interface{}, keys ...string) *StringSliceCmd
- func (c Client) SUnionStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Client) Save(context interface{}) *StatusCmd
- func (c Client) Scan(context interface{}, cursor uint64, match string, count int64) *ScanCmd
- func (c Client) ScanType(context interface{}, cursor uint64, match string, count int64, keyType string) *ScanCmd
- func (c Client) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
- func (c Client) ScriptFlush(context interface{}) *StatusCmd
- func (c Client) ScriptKill(context interface{}) *StatusCmd
- func (c Client) ScriptLoad(context interface{}, script string) *StringCmd
- func (c Client) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Client) SetArgs(context interface{}, key string, value interface{}, a SetArgs) *StatusCmd
- func (c Client) SetBit(context interface{}, key string, offset int64, value int) *IntCmd
- func (c Client) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Client) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Client) SetRange(context interface{}, key string, offset int64, value string) *IntCmd
- func (c Client) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Client) Shutdown(context interface{}) *StatusCmd
- func (c Client) ShutdownNoSave(context interface{}) *StatusCmd
- func (c Client) ShutdownSave(context interface{}) *StatusCmd
- func (c Client) SlaveOf(context interface{}, host, port string) *StatusCmd
- func (c Client) SlowLogGet(context interface{}, num int64) *SlowLogCmd
- func (c Client) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
- func (c Client) SortInterfaces(context interface{}, key string, sort *Sort) *SliceCmd
- func (c Client) SortStore(context interface{}, key, store string, sort *Sort) *IntCmd
- func (c Client) StrLen(context interface{}, key string) *IntCmd
- func (c Client) String() string
- func (c *Client) Subscribe(ctx context.Context, channels ...string) *PubSub
- func (c Client) Sync(_ context.Context)
- func (c Client) TTL(context interface{}, key string) *DurationCmd
- func (c Client) Time(context interface{}) *TimeCmd
- func (c Client) Touch(context interface{}, keys ...string) *IntCmd
- func (c *Client) TxPipeline() Pipeliner
- func (c *Client) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c Client) Type(context interface{}, key string) *StatusCmd
- func (c Client) Unlink(context interface{}, keys ...string) *IntCmd
- func (c Client) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd
- func (c *Client) Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error
- func (c *Client) WithContext(ctx context.Context) *Client
- func (c *Client) WithTimeout(timeout time.Duration) *Client
- func (c Client) XAck(context interface{}, stream, group string, ids ...string) *IntCmd
- func (c Client) XAdd(context interface{}, a *XAddArgs) *StringCmd
- func (c Client) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
- func (c Client) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
- func (c Client) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
- func (c Client) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
- func (c Client) XDel(context interface{}, stream string, ids ...string) *IntCmd
- func (c Client) XGroupCreate(context interface{}, stream, group, start string) *StatusCmd
- func (c Client) XGroupCreateConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Client) XGroupCreateMkStream(context interface{}, stream, group, start string) *StatusCmd
- func (c Client) XGroupDelConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Client) XGroupDestroy(context interface{}, stream, group string) *IntCmd
- func (c Client) XGroupSetID(context interface{}, stream, group, start string) *StatusCmd
- func (c Client) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
- func (c Client) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
- func (c Client) XInfoStream(context interface{}, key string) *XInfoStreamCmd
- func (c Client) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
- func (c Client) XLen(context interface{}, stream string) *IntCmd
- func (c Client) XPending(context interface{}, stream, group string) *XPendingCmd
- func (c Client) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
- func (c Client) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Client) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Client) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
- func (c Client) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
- func (c Client) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
- func (c Client) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Client) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Client) XTrim(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Client) XTrimApprox(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Client) XTrimMaxLen(context interface{}, key string, maxLen int64) *IntCmd
- func (c Client) XTrimMaxLenApprox(context interface{}, key string, maxLen, limit int64) *IntCmd
- func (c Client) XTrimMinID(context interface{}, key string, minID string) *IntCmd
- func (c Client) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
- func (c Client) ZAdd(context interface{}, key string, members ...*Z) *IntCmd
- func (c Client) ZAddArgs(context interface{}, key string, args ZAddArgs) *IntCmd
- func (c Client) ZAddArgsIncr(context interface{}, key string, args ZAddArgs) *FloatCmd
- func (c Client) ZAddCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Client) ZAddNX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Client) ZAddNXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Client) ZAddXX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Client) ZAddXXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Client) ZCard(context interface{}, key string) *IntCmd
- func (c Client) ZCount(context interface{}, key, min, max string) *IntCmd
- func (c Client) ZDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Client) ZDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Client) ZDiffWithScores(context interface{}, keys ...string) *ZSliceCmd
- func (c Client) ZIncr(context interface{}, key string, member *Z) *FloatCmd
- func (c Client) ZIncrBy(context interface{}, key string, increment float64, member string) *FloatCmd
- func (c Client) ZIncrNX(context interface{}, key string, member *Z) *FloatCmd
- func (c Client) ZIncrXX(context interface{}, key string, member *Z) *FloatCmd
- func (c Client) ZInter(context interface{}, store *ZStore) *StringSliceCmd
- func (c Client) ZInterStore(context interface{}, destination string, store *ZStore) *IntCmd
- func (c Client) ZInterWithScores(context interface{}, store *ZStore) *ZSliceCmd
- func (c Client) ZLexCount(context interface{}, key, min, max string) *IntCmd
- func (c Client) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
- func (c Client) ZPopMax(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Client) ZPopMin(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Client) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
- func (c Client) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Client) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
- func (c Client) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
- func (c Client) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Client) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
- func (c Client) ZRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Client) ZRank(context interface{}, key, member string) *IntCmd
- func (c Client) ZRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Client) ZRemRangeByLex(context interface{}, key, min, max string) *IntCmd
- func (c Client) ZRemRangeByRank(context interface{}, key string, start, stop int64) *IntCmd
- func (c Client) ZRemRangeByScore(context interface{}, key, min, max string) *IntCmd
- func (c Client) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Client) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRevRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Client) ZRevRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Client) ZRevRank(context interface{}, key, member string) *IntCmd
- func (c Client) ZScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Client) ZScore(context interface{}, key, member string) *FloatCmd
- func (c Client) ZUnion(context interface{}, store ZStore) *StringSliceCmd
- func (c Client) ZUnionStore(context interface{}, dest string, store *ZStore) *IntCmd
- func (c Client) ZUnionWithScores(context interface{}, store ZStore) *ZSliceCmd
- type ClusterClient
- func (hs *ClusterClient) AddHook(hook Hook)
- func (c ClusterClient) Append(context interface{}, key, value string) *IntCmd
- func (c ClusterClient) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c ClusterClient) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c ClusterClient) BRPopLPush(context interface{}, source, destination string, timeout time.Duration) *StringCmd
- func (c ClusterClient) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c ClusterClient) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c ClusterClient) BgRewriteAOF(context interface{}) *StatusCmd
- func (c ClusterClient) BgSave(context interface{}) *StatusCmd
- func (c ClusterClient) BitCount(context interface{}, key string, bitCount *BitCount) *IntCmd
- func (c ClusterClient) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
- func (c ClusterClient) BitOpAnd(context interface{}, destKey string, keys ...string) *IntCmd
- func (c ClusterClient) BitOpNot(context interface{}, destKey string, key string) *IntCmd
- func (c ClusterClient) BitOpOr(context interface{}, destKey string, keys ...string) *IntCmd
- func (c ClusterClient) BitOpXor(context interface{}, destKey string, keys ...string) *IntCmd
- func (c ClusterClient) BitPos(context interface{}, key string, bit int64, pos ...int64) *IntCmd
- func (c ClusterClient) ClientGetName(context interface{}) *StringCmd
- func (c ClusterClient) ClientID(context interface{}) *IntCmd
- func (c ClusterClient) ClientKill(context interface{}, ipPort string) *StatusCmd
- func (c ClusterClient) ClientKillByFilter(context interface{}, keys ...string) *IntCmd
- func (c ClusterClient) ClientList(context interface{}) *StringCmd
- func (c ClusterClient) ClientPause(context interface{}, dur time.Duration) *BoolCmd
- func (c ClusterClient) ClientUnblock(context interface{}, id int64) *IntCmd
- func (c ClusterClient) ClientUnblockWithError(context interface{}, id int64) *IntCmd
- func (c *ClusterClient) Close() error
- func (c ClusterClient) ClusterAddSlots(context interface{}, slots ...int) *StatusCmd
- func (c ClusterClient) ClusterAddSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c ClusterClient) ClusterCountFailureReports(context interface{}, nodeID string) *IntCmd
- func (c ClusterClient) ClusterCountKeysInSlot(context interface{}, slot int) *IntCmd
- func (c ClusterClient) ClusterDelSlots(context interface{}, slots ...int) *StatusCmd
- func (c ClusterClient) ClusterDelSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c ClusterClient) ClusterFailover(context interface{}) *StatusCmd
- func (c ClusterClient) ClusterForget(context interface{}, nodeID string) *StatusCmd
- func (c ClusterClient) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
- func (c ClusterClient) ClusterInfo(context interface{}) *StringCmd
- func (c ClusterClient) ClusterKeySlot(context interface{}, key string) *IntCmd
- func (c ClusterClient) ClusterMeet(context interface{}, host, port string) *StatusCmd
- func (c ClusterClient) ClusterNodes(context interface{}) *StringCmd
- func (c ClusterClient) ClusterReplicate(context interface{}, nodeID string) *StatusCmd
- func (c ClusterClient) ClusterResetHard(context interface{}) *StatusCmd
- func (c ClusterClient) ClusterResetSoft(context interface{}) *StatusCmd
- func (c ClusterClient) ClusterSaveConfig(context interface{}) *StatusCmd
- func (c ClusterClient) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
- func (c ClusterClient) ClusterSlots(context interface{}) *ClusterSlotsCmd
- func (c ClusterClient) Command(context interface{}) *CommandsInfoCmd
- func (c ClusterClient) ConfigGet(context interface{}, parameter string) *SliceCmd
- func (c ClusterClient) ConfigResetStat(context interface{}) *StatusCmd
- func (c ClusterClient) ConfigRewrite(context interface{}) *StatusCmd
- func (c ClusterClient) ConfigSet(context interface{}, parameter, value string) *StatusCmd
- func (c *ClusterClient) Context() context.Context
- func (c *ClusterClient) DBSize(jCtx interface{}) *IntCmd
- func (c ClusterClient) DebugObject(context interface{}, key string) *StringCmd
- func (c ClusterClient) Decr(context interface{}, key string) *IntCmd
- func (c ClusterClient) DecrBy(context interface{}, key string, decrement int64) *IntCmd
- func (c ClusterClient) Del(context interface{}, keys ...string) *IntCmd
- func (c *ClusterClient) Do(ctx context.Context, args ...interface{}) *Cmd
- func (c ClusterClient) Dump(context interface{}, key string) *StringCmd
- func (c ClusterClient) Echo(context interface{}, message interface{}) *StringCmd
- func (c ClusterClient) Eval(context interface{}, script string, keys []string, args ...interface{}) *Cmd
- func (c ClusterClient) EvalSha(context interface{}, sha1 string, keys []string, args ...interface{}) *Cmd
- func (c ClusterClient) Exists(context interface{}, keys ...string) *IntCmd
- func (c ClusterClient) Expire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c ClusterClient) ExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c ClusterClient) FlushAll(context interface{}) *StatusCmd
- func (c ClusterClient) FlushAllAsync(context interface{}) *StatusCmd
- func (c ClusterClient) FlushDB(context interface{}) *StatusCmd
- func (c ClusterClient) FlushDBAsync(context interface{}) *StatusCmd
- func (c *ClusterClient) ForEachMaster(ctx context.Context, fn func(ctx context.Context, client *Client) error) error
- func (c *ClusterClient) ForEachShard(ctx context.Context, fn func(ctx context.Context, client *Client) error) error
- func (c *ClusterClient) ForEachSlave(ctx context.Context, fn func(ctx context.Context, client *Client) error) error
- func (c ClusterClient) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
- func (c ClusterClient) GeoDist(context interface{}, key string, member1, member2, unit string) *FloatCmd
- func (c ClusterClient) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
- func (c ClusterClient) GeoPos(context interface{}, key string, members ...string) *GeoPosCmd
- func (c ClusterClient) GeoRadius(context interface{}, key string, longitude, latitude float64, ...) *GeoLocationCmd
- func (c ClusterClient) GeoRadiusByMember(context interface{}, key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c ClusterClient) GeoRadiusByMemberStore(context interface{}, key, member string, query *GeoRadiusQuery) *IntCmd
- func (c ClusterClient) GeoRadiusStore(context interface{}, key string, longitude, latitude float64, ...) *IntCmd
- func (c ClusterClient) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
- func (c ClusterClient) GeoSearchLocation(context interface{}, key string, q *GeoSearchLocationQuery) *GeoSearchLocationCmd
- func (c ClusterClient) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
- func (c ClusterClient) Get(context interface{}, key string) *StringCmd
- func (c ClusterClient) GetBit(context interface{}, key string, offset int64) *IntCmd
- func (c ClusterClient) GetDel(context interface{}, key string) *StringCmd
- func (c ClusterClient) GetEx(context interface{}, key string, expiration time.Duration) *StringCmd
- func (c ClusterClient) GetRange(context interface{}, key string, start, end int64) *StringCmd
- func (c ClusterClient) GetSet(context interface{}, key string, value interface{}) *StringCmd
- func (c ClusterClient) HDel(context interface{}, key string, fields ...string) *IntCmd
- func (c ClusterClient) HExists(context interface{}, key, field string) *BoolCmd
- func (c ClusterClient) HGet(context interface{}, key, field string) *StringCmd
- func (c ClusterClient) HGetAll(context interface{}, key string) *StringStringMapCmd
- func (c ClusterClient) HIncrBy(context interface{}, key, field string, incr int64) *IntCmd
- func (c ClusterClient) HIncrByFloat(context interface{}, key, field string, incr float64) *FloatCmd
- func (c ClusterClient) HKeys(context interface{}, key string) *StringSliceCmd
- func (c ClusterClient) HLen(context interface{}, key string) *IntCmd
- func (c ClusterClient) HMGet(context interface{}, key string, fields ...string) *SliceCmd
- func (c ClusterClient) HMSet(context interface{}, key string, values ...interface{}) *BoolCmd
- func (c ClusterClient) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
- func (c ClusterClient) HScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) HSet(context interface{}, key string, values ...interface{}) *IntCmd
- func (c ClusterClient) HSetNX(context interface{}, key, field string, value interface{}) *BoolCmd
- func (c ClusterClient) HVals(context interface{}, key string) *StringSliceCmd
- func (c ClusterClient) Incr(context interface{}, key string) *IntCmd
- func (c ClusterClient) IncrBy(context interface{}, key string, value int64) *IntCmd
- func (c ClusterClient) IncrByFloat(context interface{}, key string, value float64) *FloatCmd
- func (c ClusterClient) Info(context interface{}, section ...string) *StringCmd
- func (c ClusterClient) Keys(context interface{}, pattern string) *StringSliceCmd
- func (c ClusterClient) LIndex(context interface{}, key string, index int64) *StringCmd
- func (c ClusterClient) LInsert(context interface{}, key, op string, pivot, value interface{}) *IntCmd
- func (c ClusterClient) LInsertAfter(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c ClusterClient) LInsertBefore(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c ClusterClient) LLen(context interface{}, key string) *IntCmd
- func (c ClusterClient) LMove(context interface{}, source, destination, srcpos, destpos string) *StringCmd
- func (c ClusterClient) LPop(context interface{}, key string) *StringCmd
- func (c ClusterClient) LPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c ClusterClient) LPos(context interface{}, key string, value string, a LPosArgs) *IntCmd
- func (c ClusterClient) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
- func (c ClusterClient) LPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c ClusterClient) LPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c ClusterClient) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c ClusterClient) LRem(context interface{}, key string, count int64, value interface{}) *IntCmd
- func (c ClusterClient) LSet(context interface{}, key string, index int64, value interface{}) *StatusCmd
- func (c ClusterClient) LTrim(context interface{}, key string, start, stop int64) *StatusCmd
- func (c ClusterClient) LastSave(context interface{}) *IntCmd
- func (c ClusterClient) MGet(context interface{}, keys ...string) *SliceCmd
- func (c ClusterClient) MSet(context interface{}, values ...interface{}) *StatusCmd
- func (c ClusterClient) MSetNX(context interface{}, values ...interface{}) *BoolCmd
- func (c *ClusterClient) MasterForKey(ctx context.Context, key string) (*Client, error)
- func (c ClusterClient) MemoryUsage(context interface{}, key string, samples ...int) *IntCmd
- func (c ClusterClient) Migrate(context interface{}, host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c ClusterClient) Move(context interface{}, key string, db int) *BoolCmd
- func (c ClusterClient) ObjectEncoding(context interface{}, key string) *StringCmd
- func (c ClusterClient) ObjectIdleTime(context interface{}, key string) *DurationCmd
- func (c ClusterClient) ObjectRefCount(context interface{}, key string) *IntCmd
- func (c *ClusterClient) Options() *ClusterOptions
- func (c ClusterClient) PExpire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c ClusterClient) PExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c ClusterClient) PFAdd(context interface{}, key string, els ...interface{}) *IntCmd
- func (c ClusterClient) PFCount(context interface{}, keys ...string) *IntCmd
- func (c ClusterClient) PFMerge(context interface{}, dest string, keys ...string) *StatusCmd
- func (c *ClusterClient) PSubscribe(ctx context.Context, channels ...string) *PubSub
- func (c ClusterClient) PTTL(context interface{}, key string) *DurationCmd
- func (c ClusterClient) Persist(context interface{}, key string) *BoolCmd
- func (c ClusterClient) Ping(context interface{}) *StatusCmd
- func (c *ClusterClient) Pipeline() Pipeliner
- func (c *ClusterClient) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c *ClusterClient) PoolStats() *PoolStats
- func (c *ClusterClient) Process(ctx context.Context, cmd Cmder) error
- func (c ClusterClient) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
- func (c ClusterClient) PubSubNumPat(context interface{}) *IntCmd
- func (c ClusterClient) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
- func (c ClusterClient) Publish(context interface{}, channel string, message interface{}) *IntCmd
- func (c ClusterClient) Quit(ctx interface{}) *StatusCmd
- func (c ClusterClient) RPop(context interface{}, key string) *StringCmd
- func (c ClusterClient) RPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c ClusterClient) RPopLPush(context interface{}, source, destination string) *StringCmd
- func (c ClusterClient) RPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c ClusterClient) RPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c ClusterClient) RandomKey(context interface{}) *StringCmd
- func (c ClusterClient) ReadOnly(context interface{}) *StatusCmd
- func (c ClusterClient) ReadWrite(context interface{}) *StatusCmd
- func (c *ClusterClient) ReloadState(ctx context.Context)
- func (c ClusterClient) Rename(context interface{}, key, newkey string) *StatusCmd
- func (c ClusterClient) RenameNX(context interface{}, key, newkey string) *BoolCmd
- func (c ClusterClient) Restore(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c ClusterClient) RestoreReplace(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c ClusterClient) SAdd(context interface{}, key string, members ...interface{}) *IntCmd
- func (c ClusterClient) SCard(context interface{}, key string) *IntCmd
- func (c ClusterClient) SDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c ClusterClient) SDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c ClusterClient) SInter(context interface{}, keys ...string) *StringSliceCmd
- func (c ClusterClient) SInterStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c ClusterClient) SIsMember(context interface{}, key string, member interface{}) *BoolCmd
- func (c ClusterClient) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
- func (c ClusterClient) SMembers(context interface{}, key string) *StringSliceCmd
- func (c ClusterClient) SMembersMap(context interface{}, key string) *StringStructMapCmd
- func (c ClusterClient) SMove(context interface{}, source, destination string, member interface{}) *BoolCmd
- func (c ClusterClient) SPop(context interface{}, key string) *StringCmd
- func (c ClusterClient) SPopN(context interface{}, key string, count int64) *StringSliceCmd
- func (c ClusterClient) SRandMember(context interface{}, key string) *StringCmd
- func (c ClusterClient) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
- func (c ClusterClient) SRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c ClusterClient) SScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) SUnion(context interface{}, keys ...string) *StringSliceCmd
- func (c ClusterClient) SUnionStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c ClusterClient) Save(context interface{}) *StatusCmd
- func (c ClusterClient) Scan(context interface{}, cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) ScanType(context interface{}, cursor uint64, match string, count int64, keyType string) *ScanCmd
- func (c *ClusterClient) ScriptExists(jctx interface{}, hashes ...string) *BoolSliceCmd
- func (c *ClusterClient) ScriptFlush(jCtx interface{}) *StatusCmd
- func (c ClusterClient) ScriptKill(context interface{}) *StatusCmd
- func (c *ClusterClient) ScriptLoad(jctx interface{}, script string) *StringCmd
- func (c ClusterClient) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c ClusterClient) SetArgs(context interface{}, key string, value interface{}, a SetArgs) *StatusCmd
- func (c ClusterClient) SetBit(context interface{}, key string, offset int64, value int) *IntCmd
- func (c ClusterClient) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c ClusterClient) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c ClusterClient) SetRange(context interface{}, key string, offset int64, value string) *IntCmd
- func (c ClusterClient) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c ClusterClient) Shutdown(context interface{}) *StatusCmd
- func (c ClusterClient) ShutdownNoSave(context interface{}) *StatusCmd
- func (c ClusterClient) ShutdownSave(context interface{}) *StatusCmd
- func (c *ClusterClient) SlaveForKey(ctx context.Context, key string) (*Client, error)
- func (c ClusterClient) SlaveOf(context interface{}, host, port string) *StatusCmd
- func (c ClusterClient) SlowLogGet(context interface{}, num int64) *SlowLogCmd
- func (c ClusterClient) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
- func (c ClusterClient) SortInterfaces(context interface{}, key string, sort *Sort) *SliceCmd
- func (c ClusterClient) SortStore(context interface{}, key, store string, sort *Sort) *IntCmd
- func (c ClusterClient) StrLen(context interface{}, key string) *IntCmd
- func (c *ClusterClient) Subscribe(ctx context.Context, channels ...string) *PubSub
- func (c ClusterClient) Sync(_ context.Context)
- func (c ClusterClient) TTL(context interface{}, key string) *DurationCmd
- func (c ClusterClient) Time(context interface{}) *TimeCmd
- func (c ClusterClient) Touch(context interface{}, keys ...string) *IntCmd
- func (c *ClusterClient) TxPipeline() Pipeliner
- func (c *ClusterClient) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c ClusterClient) Type(context interface{}, key string) *StatusCmd
- func (c ClusterClient) Unlink(context interface{}, keys ...string) *IntCmd
- func (c ClusterClient) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd
- func (c *ClusterClient) Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error
- func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient
- func (c ClusterClient) XAck(context interface{}, stream, group string, ids ...string) *IntCmd
- func (c ClusterClient) XAdd(context interface{}, a *XAddArgs) *StringCmd
- func (c ClusterClient) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
- func (c ClusterClient) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
- func (c ClusterClient) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
- func (c ClusterClient) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
- func (c ClusterClient) XDel(context interface{}, stream string, ids ...string) *IntCmd
- func (c ClusterClient) XGroupCreate(context interface{}, stream, group, start string) *StatusCmd
- func (c ClusterClient) XGroupCreateConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c ClusterClient) XGroupCreateMkStream(context interface{}, stream, group, start string) *StatusCmd
- func (c ClusterClient) XGroupDelConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c ClusterClient) XGroupDestroy(context interface{}, stream, group string) *IntCmd
- func (c ClusterClient) XGroupSetID(context interface{}, stream, group, start string) *StatusCmd
- func (c ClusterClient) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
- func (c ClusterClient) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
- func (c ClusterClient) XInfoStream(context interface{}, key string) *XInfoStreamCmd
- func (c ClusterClient) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
- func (c ClusterClient) XLen(context interface{}, stream string) *IntCmd
- func (c ClusterClient) XPending(context interface{}, stream, group string) *XPendingCmd
- func (c ClusterClient) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
- func (c ClusterClient) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c ClusterClient) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c ClusterClient) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
- func (c ClusterClient) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
- func (c ClusterClient) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
- func (c ClusterClient) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c ClusterClient) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c ClusterClient) XTrim(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c ClusterClient) XTrimApprox(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c ClusterClient) XTrimMaxLen(context interface{}, key string, maxLen int64) *IntCmd
- func (c ClusterClient) XTrimMaxLenApprox(context interface{}, key string, maxLen, limit int64) *IntCmd
- func (c ClusterClient) XTrimMinID(context interface{}, key string, minID string) *IntCmd
- func (c ClusterClient) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
- func (c ClusterClient) ZAdd(context interface{}, key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddArgs(context interface{}, key string, args ZAddArgs) *IntCmd
- func (c ClusterClient) ZAddArgsIncr(context interface{}, key string, args ZAddArgs) *FloatCmd
- func (c ClusterClient) ZAddCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddNX(context interface{}, key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddNXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddXX(context interface{}, key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddXXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZCard(context interface{}, key string) *IntCmd
- func (c ClusterClient) ZCount(context interface{}, key, min, max string) *IntCmd
- func (c ClusterClient) ZDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c ClusterClient) ZDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c ClusterClient) ZDiffWithScores(context interface{}, keys ...string) *ZSliceCmd
- func (c ClusterClient) ZIncr(context interface{}, key string, member *Z) *FloatCmd
- func (c ClusterClient) ZIncrBy(context interface{}, key string, increment float64, member string) *FloatCmd
- func (c ClusterClient) ZIncrNX(context interface{}, key string, member *Z) *FloatCmd
- func (c ClusterClient) ZIncrXX(context interface{}, key string, member *Z) *FloatCmd
- func (c ClusterClient) ZInter(context interface{}, store *ZStore) *StringSliceCmd
- func (c ClusterClient) ZInterStore(context interface{}, destination string, store *ZStore) *IntCmd
- func (c ClusterClient) ZInterWithScores(context interface{}, store *ZStore) *ZSliceCmd
- func (c ClusterClient) ZLexCount(context interface{}, key, min, max string) *IntCmd
- func (c ClusterClient) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
- func (c ClusterClient) ZPopMax(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c ClusterClient) ZPopMin(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c ClusterClient) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
- func (c ClusterClient) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c ClusterClient) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
- func (c ClusterClient) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
- func (c ClusterClient) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c ClusterClient) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
- func (c ClusterClient) ZRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c ClusterClient) ZRank(context interface{}, key, member string) *IntCmd
- func (c ClusterClient) ZRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c ClusterClient) ZRemRangeByLex(context interface{}, key, min, max string) *IntCmd
- func (c ClusterClient) ZRemRangeByRank(context interface{}, key string, start, stop int64) *IntCmd
- func (c ClusterClient) ZRemRangeByScore(context interface{}, key, min, max string) *IntCmd
- func (c ClusterClient) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c ClusterClient) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRevRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c ClusterClient) ZRevRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c ClusterClient) ZRevRank(context interface{}, key, member string) *IntCmd
- func (c ClusterClient) ZScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) ZScore(context interface{}, key, member string) *FloatCmd
- func (c ClusterClient) ZUnion(context interface{}, store ZStore) *StringSliceCmd
- func (c ClusterClient) ZUnionStore(context interface{}, dest string, store *ZStore) *IntCmd
- func (c ClusterClient) ZUnionWithScores(context interface{}, store ZStore) *ZSliceCmd
- type ClusterNode
- type ClusterOptions
- type ClusterSlot
- type ClusterSlotsCmd
- func (cmd *ClusterSlotsCmd) Args() []interface{}
- func (cmd *ClusterSlotsCmd) Err() error
- func (cmd *ClusterSlotsCmd) FullName() string
- func (cmd *ClusterSlotsCmd) Name() string
- func (cmd *ClusterSlotsCmd) Result() ([]ClusterSlot, error)
- func (cmd *ClusterSlotsCmd) SetErr(e error)
- func (cmd *ClusterSlotsCmd) String() string
- func (cmd *ClusterSlotsCmd) Val() []ClusterSlot
- type Cmd
- func (cmd *Cmd) Args() []interface{}
- func (cmd *Cmd) Bool() (bool, error)
- func (cmd *Cmd) Err() error
- func (cmd *Cmd) Float32() (float32, error)
- func (cmd *Cmd) Float64() (float64, error)
- func (cmd *Cmd) FullName() string
- func (cmd *Cmd) Int() (int, error)
- func (cmd *Cmd) Int64() (int64, error)
- func (cmd *Cmd) Name() string
- func (cmd *Cmd) Result() (interface{}, error)
- func (cmd *Cmd) SetErr(e error)
- func (cmd *Cmd) String() string
- func (cmd *Cmd) Text() (string, error)
- func (cmd *Cmd) Uint64() (uint64, error)
- func (cmd *Cmd) Val() interface{}
- type Cmdable
- type Cmder
- type CommandInfo
- type CommandsInfoCmd
- func (cmd *CommandsInfoCmd) Args() []interface{}
- func (cmd *CommandsInfoCmd) Err() error
- func (cmd *CommandsInfoCmd) FullName() string
- func (cmd *CommandsInfoCmd) Name() string
- func (cmd *CommandsInfoCmd) Result() (map[string]*CommandInfo, error)
- func (cmd *CommandsInfoCmd) SetErr(e error)
- func (cmd *CommandsInfoCmd) String() string
- func (cmd *CommandsInfoCmd) Val() map[string]*CommandInfo
- type Conn
- func (c *Conn) Pipeline() Pipeliner
- func (c *Conn) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Conn) Process(ctx context.Context, cmd Cmder) error
- func (c *Conn) TxPipeline() Pipeliner
- func (c *Conn) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- type ConsistentHash
- type DurationCmd
- func (cmd *DurationCmd) Args() []interface{}
- func (cmd *DurationCmd) Err() error
- func (cmd *DurationCmd) FullName() string
- func (cmd *DurationCmd) Name() string
- func (cmd *DurationCmd) Result() (time.Duration, error)
- func (cmd *DurationCmd) SetErr(e error)
- func (cmd *DurationCmd) String() string
- func (cmd *DurationCmd) Val() time.Duration
- type Error
- type FailoverOptions
- type FloatCmd
- func (cmd *FloatCmd) Args() []interface{}
- func (cmd *FloatCmd) Err() error
- func (cmd *FloatCmd) FullName() string
- func (cmd *FloatCmd) Name() string
- func (cmd *FloatCmd) Result() (float64, error)
- func (cmd *FloatCmd) SetErr(e error)
- func (cmd *FloatCmd) String() string
- func (cmd *FloatCmd) Val() float64
- type FloatSliceCmd
- func (cmd *FloatSliceCmd) Args() []interface{}
- func (cmd *FloatSliceCmd) Err() error
- func (cmd *FloatSliceCmd) FullName() string
- func (cmd *FloatSliceCmd) Name() string
- func (cmd *FloatSliceCmd) Result() ([]float64, error)
- func (cmd *FloatSliceCmd) SetErr(e error)
- func (cmd *FloatSliceCmd) String() string
- func (cmd *FloatSliceCmd) Val() []float64
- type GeoLocation
- type GeoLocationCmd
- func (cmd *GeoLocationCmd) Args() []interface{}
- func (cmd *GeoLocationCmd) Err() error
- func (cmd *GeoLocationCmd) FullName() string
- func (cmd *GeoLocationCmd) Name() string
- func (cmd *GeoLocationCmd) Result() ([]GeoLocation, error)
- func (cmd *GeoLocationCmd) SetErr(e error)
- func (cmd *GeoLocationCmd) String() string
- func (cmd *GeoLocationCmd) Val() []GeoLocation
- type GeoPos
- type GeoPosCmd
- func (cmd *GeoPosCmd) Args() []interface{}
- func (cmd *GeoPosCmd) Err() error
- func (cmd *GeoPosCmd) FullName() string
- func (cmd *GeoPosCmd) Name() string
- func (cmd *GeoPosCmd) Result() ([]*GeoPos, error)
- func (cmd *GeoPosCmd) SetErr(e error)
- func (cmd *GeoPosCmd) String() string
- func (cmd *GeoPosCmd) Val() []*GeoPos
- type GeoRadiusQuery
- type GeoSearchLocationCmd
- func (cmd *GeoSearchLocationCmd) Args() []interface{}
- func (cmd *GeoSearchLocationCmd) Err() error
- func (cmd *GeoSearchLocationCmd) FullName() string
- func (cmd *GeoSearchLocationCmd) Name() string
- func (cmd *GeoSearchLocationCmd) Result() ([]GeoLocation, error)
- func (cmd *GeoSearchLocationCmd) SetErr(e error)
- func (cmd *GeoSearchLocationCmd) String() string
- func (cmd *GeoSearchLocationCmd) Val() []GeoLocation
- type GeoSearchLocationQuery
- type GeoSearchQuery
- type GeoSearchStoreQuery
- type Hook
- type IntCmd
- func (cmd *IntCmd) Args() []interface{}
- func (cmd *IntCmd) Err() error
- func (cmd *IntCmd) FullName() string
- func (cmd *IntCmd) Name() string
- func (cmd *IntCmd) Result() (int64, error)
- func (cmd *IntCmd) SetErr(e error)
- func (cmd *IntCmd) String() string
- func (cmd *IntCmd) Uint64() (uint64, error)
- func (cmd *IntCmd) Val() int64
- type IntSliceCmd
- func (cmd *IntSliceCmd) Args() []interface{}
- func (cmd *IntSliceCmd) Err() error
- func (cmd *IntSliceCmd) FullName() string
- func (cmd *IntSliceCmd) Name() string
- func (cmd *IntSliceCmd) Result() ([]int64, error)
- func (cmd *IntSliceCmd) SetErr(e error)
- func (cmd *IntSliceCmd) String() string
- func (cmd *IntSliceCmd) Val() []int64
- type LPosArgs
- type Limiter
- type Message
- type Options
- type Pipeline
- func (c Pipeline) Append(context interface{}, key, value string) *IntCmd
- func (c Pipeline) Auth(ctx context.Context, password string) *StatusCmd
- func (c Pipeline) AuthACL(ctx context.Context, username, password string) *StatusCmd
- func (c Pipeline) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Pipeline) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Pipeline) BRPopLPush(context interface{}, source, destination string, timeout time.Duration) *StringCmd
- func (c Pipeline) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Pipeline) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Pipeline) BgRewriteAOF(context interface{}) *StatusCmd
- func (c Pipeline) BgSave(context interface{}) *StatusCmd
- func (c Pipeline) BitCount(context interface{}, key string, bitCount *BitCount) *IntCmd
- func (c Pipeline) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
- func (c Pipeline) BitOpAnd(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Pipeline) BitOpNot(context interface{}, destKey string, key string) *IntCmd
- func (c Pipeline) BitOpOr(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Pipeline) BitOpXor(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Pipeline) BitPos(context interface{}, key string, bit int64, pos ...int64) *IntCmd
- func (c Pipeline) ClientGetName(context interface{}) *StringCmd
- func (c Pipeline) ClientID(context interface{}) *IntCmd
- func (c Pipeline) ClientKill(context interface{}, ipPort string) *StatusCmd
- func (c Pipeline) ClientKillByFilter(context interface{}, keys ...string) *IntCmd
- func (c Pipeline) ClientList(context interface{}) *StringCmd
- func (c Pipeline) ClientPause(context interface{}, dur time.Duration) *BoolCmd
- func (c Pipeline) ClientSetName(ctx context.Context, name string) *BoolCmd
- func (c Pipeline) ClientUnblock(context interface{}, id int64) *IntCmd
- func (c Pipeline) ClientUnblockWithError(context interface{}, id int64) *IntCmd
- func (c *Pipeline) Close() error
- func (c Pipeline) ClusterAddSlots(context interface{}, slots ...int) *StatusCmd
- func (c Pipeline) ClusterAddSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Pipeline) ClusterCountFailureReports(context interface{}, nodeID string) *IntCmd
- func (c Pipeline) ClusterCountKeysInSlot(context interface{}, slot int) *IntCmd
- func (c Pipeline) ClusterDelSlots(context interface{}, slots ...int) *StatusCmd
- func (c Pipeline) ClusterDelSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Pipeline) ClusterFailover(context interface{}) *StatusCmd
- func (c Pipeline) ClusterForget(context interface{}, nodeID string) *StatusCmd
- func (c Pipeline) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
- func (c Pipeline) ClusterInfo(context interface{}) *StringCmd
- func (c Pipeline) ClusterKeySlot(context interface{}, key string) *IntCmd
- func (c Pipeline) ClusterMeet(context interface{}, host, port string) *StatusCmd
- func (c Pipeline) ClusterNodes(context interface{}) *StringCmd
- func (c Pipeline) ClusterReplicate(context interface{}, nodeID string) *StatusCmd
- func (c Pipeline) ClusterResetHard(context interface{}) *StatusCmd
- func (c Pipeline) ClusterResetSoft(context interface{}) *StatusCmd
- func (c Pipeline) ClusterSaveConfig(context interface{}) *StatusCmd
- func (c Pipeline) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
- func (c Pipeline) ClusterSlots(context interface{}) *ClusterSlotsCmd
- func (c Pipeline) Command(context interface{}) *CommandsInfoCmd
- func (c Pipeline) ConfigGet(context interface{}, parameter string) *SliceCmd
- func (c Pipeline) ConfigResetStat(context interface{}) *StatusCmd
- func (c Pipeline) ConfigRewrite(context interface{}) *StatusCmd
- func (c Pipeline) ConfigSet(context interface{}, parameter, value string) *StatusCmd
- func (c Pipeline) DBSize(context interface{}) *IntCmd
- func (c Pipeline) DebugObject(context interface{}, key string) *StringCmd
- func (c Pipeline) Decr(context interface{}, key string) *IntCmd
- func (c Pipeline) DecrBy(context interface{}, key string, decrement int64) *IntCmd
- func (c Pipeline) Del(context interface{}, keys ...string) *IntCmd
- func (c *Pipeline) Discard() error
- func (c *Pipeline) Do(ctx context.Context, args ...interface{}) *Cmd
- func (c Pipeline) Dump(context interface{}, key string) *StringCmd
- func (c Pipeline) Echo(context interface{}, message interface{}) *StringCmd
- func (c Pipeline) Eval(context interface{}, script string, keys []string, args ...interface{}) *Cmd
- func (c Pipeline) EvalSha(context interface{}, sha1 string, keys []string, args ...interface{}) *Cmd
- func (c *Pipeline) Exec(ctx context.Context) ([]Cmder, error)
- func (c Pipeline) Exists(context interface{}, keys ...string) *IntCmd
- func (c Pipeline) Expire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Pipeline) ExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Pipeline) FlushAll(context interface{}) *StatusCmd
- func (c Pipeline) FlushAllAsync(context interface{}) *StatusCmd
- func (c Pipeline) FlushDB(context interface{}) *StatusCmd
- func (c Pipeline) FlushDBAsync(context interface{}) *StatusCmd
- func (c Pipeline) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Pipeline) GeoDist(context interface{}, key string, member1, member2, unit string) *FloatCmd
- func (c Pipeline) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
- func (c Pipeline) GeoPos(context interface{}, key string, members ...string) *GeoPosCmd
- func (c Pipeline) GeoRadius(context interface{}, key string, longitude, latitude float64, ...) *GeoLocationCmd
- func (c Pipeline) GeoRadiusByMember(context interface{}, key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Pipeline) GeoRadiusByMemberStore(context interface{}, key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Pipeline) GeoRadiusStore(context interface{}, key string, longitude, latitude float64, ...) *IntCmd
- func (c Pipeline) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
- func (c Pipeline) GeoSearchLocation(context interface{}, key string, q *GeoSearchLocationQuery) *GeoSearchLocationCmd
- func (c Pipeline) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
- func (c Pipeline) Get(context interface{}, key string) *StringCmd
- func (c Pipeline) GetBit(context interface{}, key string, offset int64) *IntCmd
- func (c Pipeline) GetDel(context interface{}, key string) *StringCmd
- func (c Pipeline) GetEx(context interface{}, key string, expiration time.Duration) *StringCmd
- func (c Pipeline) GetRange(context interface{}, key string, start, end int64) *StringCmd
- func (c Pipeline) GetSet(context interface{}, key string, value interface{}) *StringCmd
- func (c Pipeline) HDel(context interface{}, key string, fields ...string) *IntCmd
- func (c Pipeline) HExists(context interface{}, key, field string) *BoolCmd
- func (c Pipeline) HGet(context interface{}, key, field string) *StringCmd
- func (c Pipeline) HGetAll(context interface{}, key string) *StringStringMapCmd
- func (c Pipeline) HIncrBy(context interface{}, key, field string, incr int64) *IntCmd
- func (c Pipeline) HIncrByFloat(context interface{}, key, field string, incr float64) *FloatCmd
- func (c Pipeline) HKeys(context interface{}, key string) *StringSliceCmd
- func (c Pipeline) HLen(context interface{}, key string) *IntCmd
- func (c Pipeline) HMGet(context interface{}, key string, fields ...string) *SliceCmd
- func (c Pipeline) HMSet(context interface{}, key string, values ...interface{}) *BoolCmd
- func (c Pipeline) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
- func (c Pipeline) HScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) HSet(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Pipeline) HSetNX(context interface{}, key, field string, value interface{}) *BoolCmd
- func (c Pipeline) HVals(context interface{}, key string) *StringSliceCmd
- func (c Pipeline) Incr(context interface{}, key string) *IntCmd
- func (c Pipeline) IncrBy(context interface{}, key string, value int64) *IntCmd
- func (c Pipeline) IncrByFloat(context interface{}, key string, value float64) *FloatCmd
- func (c Pipeline) Info(context interface{}, section ...string) *StringCmd
- func (c Pipeline) Keys(context interface{}, pattern string) *StringSliceCmd
- func (c Pipeline) LIndex(context interface{}, key string, index int64) *StringCmd
- func (c Pipeline) LInsert(context interface{}, key, op string, pivot, value interface{}) *IntCmd
- func (c Pipeline) LInsertAfter(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Pipeline) LInsertBefore(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Pipeline) LLen(context interface{}, key string) *IntCmd
- func (c Pipeline) LMove(context interface{}, source, destination, srcpos, destpos string) *StringCmd
- func (c Pipeline) LPop(context interface{}, key string) *StringCmd
- func (c Pipeline) LPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Pipeline) LPos(context interface{}, key string, value string, a LPosArgs) *IntCmd
- func (c Pipeline) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
- func (c Pipeline) LPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Pipeline) LPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Pipeline) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Pipeline) LRem(context interface{}, key string, count int64, value interface{}) *IntCmd
- func (c Pipeline) LSet(context interface{}, key string, index int64, value interface{}) *StatusCmd
- func (c Pipeline) LTrim(context interface{}, key string, start, stop int64) *StatusCmd
- func (c Pipeline) LastSave(context interface{}) *IntCmd
- func (c Pipeline) MGet(context interface{}, keys ...string) *SliceCmd
- func (c Pipeline) MSet(context interface{}, values ...interface{}) *StatusCmd
- func (c Pipeline) MSetNX(context interface{}, values ...interface{}) *BoolCmd
- func (c Pipeline) MemoryUsage(context interface{}, key string, samples ...int) *IntCmd
- func (c Pipeline) Migrate(context interface{}, host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Pipeline) Move(context interface{}, key string, db int) *BoolCmd
- func (c Pipeline) ObjectEncoding(context interface{}, key string) *StringCmd
- func (c Pipeline) ObjectIdleTime(context interface{}, key string) *DurationCmd
- func (c Pipeline) ObjectRefCount(context interface{}, key string) *IntCmd
- func (c Pipeline) PExpire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Pipeline) PExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Pipeline) PFAdd(context interface{}, key string, els ...interface{}) *IntCmd
- func (c Pipeline) PFCount(context interface{}, keys ...string) *IntCmd
- func (c Pipeline) PFMerge(context interface{}, dest string, keys ...string) *StatusCmd
- func (c Pipeline) PTTL(context interface{}, key string) *DurationCmd
- func (c Pipeline) Persist(context interface{}, key string) *BoolCmd
- func (c Pipeline) Ping(context interface{}) *StatusCmd
- func (c *Pipeline) Pipeline() Pipeliner
- func (c *Pipeline) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Pipeline) Process(ctx context.Context, cmd Cmder) error
- func (c Pipeline) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
- func (c Pipeline) PubSubNumPat(context interface{}) *IntCmd
- func (c Pipeline) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
- func (c Pipeline) Publish(context interface{}, channel string, message interface{}) *IntCmd
- func (c Pipeline) Quit(ctx interface{}) *StatusCmd
- func (c Pipeline) RPop(context interface{}, key string) *StringCmd
- func (c Pipeline) RPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Pipeline) RPopLPush(context interface{}, source, destination string) *StringCmd
- func (c Pipeline) RPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Pipeline) RPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Pipeline) RandomKey(context interface{}) *StringCmd
- func (c Pipeline) ReadOnly(context interface{}) *StatusCmd
- func (c Pipeline) ReadWrite(context interface{}) *StatusCmd
- func (c Pipeline) Rename(context interface{}, key, newkey string) *StatusCmd
- func (c Pipeline) RenameNX(context interface{}, key, newkey string) *BoolCmd
- func (c Pipeline) Restore(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Pipeline) RestoreReplace(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Pipeline) SAdd(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Pipeline) SCard(context interface{}, key string) *IntCmd
- func (c Pipeline) SDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Pipeline) SDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Pipeline) SInter(context interface{}, keys ...string) *StringSliceCmd
- func (c Pipeline) SInterStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Pipeline) SIsMember(context interface{}, key string, member interface{}) *BoolCmd
- func (c Pipeline) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
- func (c Pipeline) SMembers(context interface{}, key string) *StringSliceCmd
- func (c Pipeline) SMembersMap(context interface{}, key string) *StringStructMapCmd
- func (c Pipeline) SMove(context interface{}, source, destination string, member interface{}) *BoolCmd
- func (c Pipeline) SPop(context interface{}, key string) *StringCmd
- func (c Pipeline) SPopN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Pipeline) SRandMember(context interface{}, key string) *StringCmd
- func (c Pipeline) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Pipeline) SRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Pipeline) SScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) SUnion(context interface{}, keys ...string) *StringSliceCmd
- func (c Pipeline) SUnionStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Pipeline) Save(context interface{}) *StatusCmd
- func (c Pipeline) Scan(context interface{}, cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) ScanType(context interface{}, cursor uint64, match string, count int64, keyType string) *ScanCmd
- func (c Pipeline) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
- func (c Pipeline) ScriptFlush(context interface{}) *StatusCmd
- func (c Pipeline) ScriptKill(context interface{}) *StatusCmd
- func (c Pipeline) ScriptLoad(context interface{}, script string) *StringCmd
- func (c Pipeline) Select(ctx context.Context, index int) *StatusCmd
- func (c Pipeline) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Pipeline) SetArgs(context interface{}, key string, value interface{}, a SetArgs) *StatusCmd
- func (c Pipeline) SetBit(context interface{}, key string, offset int64, value int) *IntCmd
- func (c Pipeline) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Pipeline) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Pipeline) SetRange(context interface{}, key string, offset int64, value string) *IntCmd
- func (c Pipeline) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Pipeline) Shutdown(context interface{}) *StatusCmd
- func (c Pipeline) ShutdownNoSave(context interface{}) *StatusCmd
- func (c Pipeline) ShutdownSave(context interface{}) *StatusCmd
- func (c Pipeline) SlaveOf(context interface{}, host, port string) *StatusCmd
- func (c Pipeline) SlowLogGet(context interface{}, num int64) *SlowLogCmd
- func (c Pipeline) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
- func (c Pipeline) SortInterfaces(context interface{}, key string, sort *Sort) *SliceCmd
- func (c Pipeline) SortStore(context interface{}, key, store string, sort *Sort) *IntCmd
- func (c Pipeline) StrLen(context interface{}, key string) *IntCmd
- func (c Pipeline) SwapDB(ctx context.Context, index1, index2 int) *StatusCmd
- func (c Pipeline) Sync(_ context.Context)
- func (c Pipeline) TTL(context interface{}, key string) *DurationCmd
- func (c Pipeline) Time(context interface{}) *TimeCmd
- func (c Pipeline) Touch(context interface{}, keys ...string) *IntCmd
- func (c *Pipeline) TxPipeline() Pipeliner
- func (c *Pipeline) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c Pipeline) Type(context interface{}, key string) *StatusCmd
- func (c Pipeline) Unlink(context interface{}, keys ...string) *IntCmd
- func (c Pipeline) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd
- func (c Pipeline) XAck(context interface{}, stream, group string, ids ...string) *IntCmd
- func (c Pipeline) XAdd(context interface{}, a *XAddArgs) *StringCmd
- func (c Pipeline) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
- func (c Pipeline) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
- func (c Pipeline) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
- func (c Pipeline) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
- func (c Pipeline) XDel(context interface{}, stream string, ids ...string) *IntCmd
- func (c Pipeline) XGroupCreate(context interface{}, stream, group, start string) *StatusCmd
- func (c Pipeline) XGroupCreateConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Pipeline) XGroupCreateMkStream(context interface{}, stream, group, start string) *StatusCmd
- func (c Pipeline) XGroupDelConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Pipeline) XGroupDestroy(context interface{}, stream, group string) *IntCmd
- func (c Pipeline) XGroupSetID(context interface{}, stream, group, start string) *StatusCmd
- func (c Pipeline) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
- func (c Pipeline) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
- func (c Pipeline) XInfoStream(context interface{}, key string) *XInfoStreamCmd
- func (c Pipeline) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
- func (c Pipeline) XLen(context interface{}, stream string) *IntCmd
- func (c Pipeline) XPending(context interface{}, stream, group string) *XPendingCmd
- func (c Pipeline) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
- func (c Pipeline) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Pipeline) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Pipeline) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
- func (c Pipeline) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
- func (c Pipeline) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
- func (c Pipeline) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Pipeline) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Pipeline) XTrim(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Pipeline) XTrimApprox(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Pipeline) XTrimMaxLen(context interface{}, key string, maxLen int64) *IntCmd
- func (c Pipeline) XTrimMaxLenApprox(context interface{}, key string, maxLen, limit int64) *IntCmd
- func (c Pipeline) XTrimMinID(context interface{}, key string, minID string) *IntCmd
- func (c Pipeline) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
- func (c Pipeline) ZAdd(context interface{}, key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddArgs(context interface{}, key string, args ZAddArgs) *IntCmd
- func (c Pipeline) ZAddArgsIncr(context interface{}, key string, args ZAddArgs) *FloatCmd
- func (c Pipeline) ZAddCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddNX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddNXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddXX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddXXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Pipeline) ZCard(context interface{}, key string) *IntCmd
- func (c Pipeline) ZCount(context interface{}, key, min, max string) *IntCmd
- func (c Pipeline) ZDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Pipeline) ZDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Pipeline) ZDiffWithScores(context interface{}, keys ...string) *ZSliceCmd
- func (c Pipeline) ZIncr(context interface{}, key string, member *Z) *FloatCmd
- func (c Pipeline) ZIncrBy(context interface{}, key string, increment float64, member string) *FloatCmd
- func (c Pipeline) ZIncrNX(context interface{}, key string, member *Z) *FloatCmd
- func (c Pipeline) ZIncrXX(context interface{}, key string, member *Z) *FloatCmd
- func (c Pipeline) ZInter(context interface{}, store *ZStore) *StringSliceCmd
- func (c Pipeline) ZInterStore(context interface{}, destination string, store *ZStore) *IntCmd
- func (c Pipeline) ZInterWithScores(context interface{}, store *ZStore) *ZSliceCmd
- func (c Pipeline) ZLexCount(context interface{}, key, min, max string) *IntCmd
- func (c Pipeline) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
- func (c Pipeline) ZPopMax(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Pipeline) ZPopMin(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Pipeline) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
- func (c Pipeline) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Pipeline) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
- func (c Pipeline) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
- func (c Pipeline) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Pipeline) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
- func (c Pipeline) ZRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Pipeline) ZRank(context interface{}, key, member string) *IntCmd
- func (c Pipeline) ZRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Pipeline) ZRemRangeByLex(context interface{}, key, min, max string) *IntCmd
- func (c Pipeline) ZRemRangeByRank(context interface{}, key string, start, stop int64) *IntCmd
- func (c Pipeline) ZRemRangeByScore(context interface{}, key, min, max string) *IntCmd
- func (c Pipeline) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Pipeline) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRevRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Pipeline) ZRevRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Pipeline) ZRevRank(context interface{}, key, member string) *IntCmd
- func (c Pipeline) ZScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) ZScore(context interface{}, key, member string) *FloatCmd
- func (c Pipeline) ZUnion(context interface{}, store ZStore) *StringSliceCmd
- func (c Pipeline) ZUnionStore(context interface{}, dest string, store *ZStore) *IntCmd
- func (c Pipeline) ZUnionWithScores(context interface{}, store ZStore) *ZSliceCmd
- type Pipeliner
- type Pong
- type PoolStats
- type PubSub
- func (c *PubSub) Channel(opts ...ChannelOption) <-chan *Message
- func (c *PubSub) ChannelSize(size int) <-chan *Messagedeprecated
- func (c *PubSub) ChannelWithSubscriptions(_ context.Context, size int) <-chan interface{}
- func (c *PubSub) Close() error
- func (c *PubSub) PSubscribe(ctx context.Context, patterns ...string) error
- func (c *PubSub) PUnsubscribe(ctx context.Context, patterns ...string) error
- func (c *PubSub) Ping(ctx context.Context, payload ...string) error
- func (c *PubSub) Receive(ctx context.Context) (interface{}, error)
- func (c *PubSub) ReceiveMessage(ctx context.Context) (*Message, error)
- func (c *PubSub) ReceiveTimeout(ctx context.Context, timeout time.Duration) (interface{}, error)
- func (c *PubSub) String() string
- func (c *PubSub) Subscribe(ctx context.Context, channels ...string) error
- func (c *PubSub) Unsubscribe(ctx context.Context, channels ...string) error
- type Ring
- func (hs *Ring) AddHook(hook Hook)
- func (c Ring) Append(context interface{}, key, value string) *IntCmd
- func (c Ring) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Ring) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Ring) BRPopLPush(context interface{}, source, destination string, timeout time.Duration) *StringCmd
- func (c Ring) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Ring) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Ring) BgRewriteAOF(context interface{}) *StatusCmd
- func (c Ring) BgSave(context interface{}) *StatusCmd
- func (c Ring) BitCount(context interface{}, key string, bitCount *BitCount) *IntCmd
- func (c Ring) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
- func (c Ring) BitOpAnd(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Ring) BitOpNot(context interface{}, destKey string, key string) *IntCmd
- func (c Ring) BitOpOr(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Ring) BitOpXor(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Ring) BitPos(context interface{}, key string, bit int64, pos ...int64) *IntCmd
- func (c Ring) ClientGetName(context interface{}) *StringCmd
- func (c Ring) ClientID(context interface{}) *IntCmd
- func (c Ring) ClientKill(context interface{}, ipPort string) *StatusCmd
- func (c Ring) ClientKillByFilter(context interface{}, keys ...string) *IntCmd
- func (c Ring) ClientList(context interface{}) *StringCmd
- func (c Ring) ClientPause(context interface{}, dur time.Duration) *BoolCmd
- func (c Ring) ClientUnblock(context interface{}, id int64) *IntCmd
- func (c Ring) ClientUnblockWithError(context interface{}, id int64) *IntCmd
- func (c *Ring) Close() error
- func (c Ring) ClusterAddSlots(context interface{}, slots ...int) *StatusCmd
- func (c Ring) ClusterAddSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Ring) ClusterCountFailureReports(context interface{}, nodeID string) *IntCmd
- func (c Ring) ClusterCountKeysInSlot(context interface{}, slot int) *IntCmd
- func (c Ring) ClusterDelSlots(context interface{}, slots ...int) *StatusCmd
- func (c Ring) ClusterDelSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Ring) ClusterFailover(context interface{}) *StatusCmd
- func (c Ring) ClusterForget(context interface{}, nodeID string) *StatusCmd
- func (c Ring) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
- func (c Ring) ClusterInfo(context interface{}) *StringCmd
- func (c Ring) ClusterKeySlot(context interface{}, key string) *IntCmd
- func (c Ring) ClusterMeet(context interface{}, host, port string) *StatusCmd
- func (c Ring) ClusterNodes(context interface{}) *StringCmd
- func (c Ring) ClusterReplicate(context interface{}, nodeID string) *StatusCmd
- func (c Ring) ClusterResetHard(context interface{}) *StatusCmd
- func (c Ring) ClusterResetSoft(context interface{}) *StatusCmd
- func (c Ring) ClusterSaveConfig(context interface{}) *StatusCmd
- func (c Ring) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
- func (c Ring) ClusterSlots(context interface{}) *ClusterSlotsCmd
- func (c Ring) Command(context interface{}) *CommandsInfoCmd
- func (c Ring) ConfigGet(context interface{}, parameter string) *SliceCmd
- func (c Ring) ConfigResetStat(context interface{}) *StatusCmd
- func (c Ring) ConfigRewrite(context interface{}) *StatusCmd
- func (c Ring) ConfigSet(context interface{}, parameter, value string) *StatusCmd
- func (c *Ring) Context() context.Context
- func (c Ring) DBSize(context interface{}) *IntCmd
- func (c Ring) DebugObject(context interface{}, key string) *StringCmd
- func (c Ring) Decr(context interface{}, key string) *IntCmd
- func (c Ring) DecrBy(context interface{}, key string, decrement int64) *IntCmd
- func (c Ring) Del(context interface{}, keys ...string) *IntCmd
- func (c *Ring) Do(ctx context.Context, args ...interface{}) *Cmd
- func (c Ring) Dump(context interface{}, key string) *StringCmd
- func (c Ring) Echo(context interface{}, message interface{}) *StringCmd
- func (c Ring) Eval(context interface{}, script string, keys []string, args ...interface{}) *Cmd
- func (c Ring) EvalSha(context interface{}, sha1 string, keys []string, args ...interface{}) *Cmd
- func (c Ring) Exists(context interface{}, keys ...string) *IntCmd
- func (c Ring) Expire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Ring) ExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Ring) FlushAll(context interface{}) *StatusCmd
- func (c Ring) FlushAllAsync(context interface{}) *StatusCmd
- func (c Ring) FlushDB(context interface{}) *StatusCmd
- func (c Ring) FlushDBAsync(context interface{}) *StatusCmd
- func (c *Ring) ForEachShard(ctx context.Context, fn func(ctx context.Context, client *Client) error) error
- func (c Ring) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Ring) GeoDist(context interface{}, key string, member1, member2, unit string) *FloatCmd
- func (c Ring) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
- func (c Ring) GeoPos(context interface{}, key string, members ...string) *GeoPosCmd
- func (c Ring) GeoRadius(context interface{}, key string, longitude, latitude float64, ...) *GeoLocationCmd
- func (c Ring) GeoRadiusByMember(context interface{}, key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Ring) GeoRadiusByMemberStore(context interface{}, key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Ring) GeoRadiusStore(context interface{}, key string, longitude, latitude float64, ...) *IntCmd
- func (c Ring) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
- func (c Ring) GeoSearchLocation(context interface{}, key string, q *GeoSearchLocationQuery) *GeoSearchLocationCmd
- func (c Ring) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
- func (c Ring) Get(context interface{}, key string) *StringCmd
- func (c Ring) GetBit(context interface{}, key string, offset int64) *IntCmd
- func (c Ring) GetDel(context interface{}, key string) *StringCmd
- func (c Ring) GetEx(context interface{}, key string, expiration time.Duration) *StringCmd
- func (c Ring) GetRange(context interface{}, key string, start, end int64) *StringCmd
- func (c Ring) GetSet(context interface{}, key string, value interface{}) *StringCmd
- func (c Ring) HDel(context interface{}, key string, fields ...string) *IntCmd
- func (c Ring) HExists(context interface{}, key, field string) *BoolCmd
- func (c Ring) HGet(context interface{}, key, field string) *StringCmd
- func (c Ring) HGetAll(context interface{}, key string) *StringStringMapCmd
- func (c Ring) HIncrBy(context interface{}, key, field string, incr int64) *IntCmd
- func (c Ring) HIncrByFloat(context interface{}, key, field string, incr float64) *FloatCmd
- func (c Ring) HKeys(context interface{}, key string) *StringSliceCmd
- func (c Ring) HLen(context interface{}, key string) *IntCmd
- func (c Ring) HMGet(context interface{}, key string, fields ...string) *SliceCmd
- func (c Ring) HMSet(context interface{}, key string, values ...interface{}) *BoolCmd
- func (c Ring) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
- func (c Ring) HScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) HSet(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Ring) HSetNX(context interface{}, key, field string, value interface{}) *BoolCmd
- func (c Ring) HVals(context interface{}, key string) *StringSliceCmd
- func (c Ring) Incr(context interface{}, key string) *IntCmd
- func (c Ring) IncrBy(context interface{}, key string, value int64) *IntCmd
- func (c Ring) IncrByFloat(context interface{}, key string, value float64) *FloatCmd
- func (c Ring) Info(context interface{}, section ...string) *StringCmd
- func (c Ring) Keys(context interface{}, pattern string) *StringSliceCmd
- func (c Ring) LIndex(context interface{}, key string, index int64) *StringCmd
- func (c Ring) LInsert(context interface{}, key, op string, pivot, value interface{}) *IntCmd
- func (c Ring) LInsertAfter(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Ring) LInsertBefore(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Ring) LLen(context interface{}, key string) *IntCmd
- func (c Ring) LMove(context interface{}, source, destination, srcpos, destpos string) *StringCmd
- func (c Ring) LPop(context interface{}, key string) *StringCmd
- func (c Ring) LPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Ring) LPos(context interface{}, key string, value string, a LPosArgs) *IntCmd
- func (c Ring) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
- func (c Ring) LPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Ring) LPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Ring) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Ring) LRem(context interface{}, key string, count int64, value interface{}) *IntCmd
- func (c Ring) LSet(context interface{}, key string, index int64, value interface{}) *StatusCmd
- func (c Ring) LTrim(context interface{}, key string, start, stop int64) *StatusCmd
- func (c Ring) LastSave(context interface{}) *IntCmd
- func (c *Ring) Len() int
- func (c Ring) MGet(context interface{}, keys ...string) *SliceCmd
- func (c Ring) MSet(context interface{}, values ...interface{}) *StatusCmd
- func (c Ring) MSetNX(context interface{}, values ...interface{}) *BoolCmd
- func (c Ring) MemoryUsage(context interface{}, key string, samples ...int) *IntCmd
- func (c Ring) Migrate(context interface{}, host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Ring) Move(context interface{}, key string, db int) *BoolCmd
- func (c Ring) ObjectEncoding(context interface{}, key string) *StringCmd
- func (c Ring) ObjectIdleTime(context interface{}, key string) *DurationCmd
- func (c Ring) ObjectRefCount(context interface{}, key string) *IntCmd
- func (c *Ring) Options() *RingOptions
- func (c Ring) PExpire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Ring) PExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Ring) PFAdd(context interface{}, key string, els ...interface{}) *IntCmd
- func (c Ring) PFCount(context interface{}, keys ...string) *IntCmd
- func (c Ring) PFMerge(context interface{}, dest string, keys ...string) *StatusCmd
- func (c *Ring) PSubscribe(ctx context.Context, channels ...string) *PubSub
- func (c Ring) PTTL(context interface{}, key string) *DurationCmd
- func (c Ring) Persist(context interface{}, key string) *BoolCmd
- func (c Ring) Ping(context interface{}) *StatusCmd
- func (c *Ring) Pipeline() Pipeliner
- func (c *Ring) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Ring) PoolStats() *PoolStats
- func (c *Ring) Process(ctx context.Context, cmd Cmder) error
- func (c Ring) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
- func (c Ring) PubSubNumPat(context interface{}) *IntCmd
- func (c Ring) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
- func (c Ring) Publish(context interface{}, channel string, message interface{}) *IntCmd
- func (c Ring) Quit(ctx interface{}) *StatusCmd
- func (c Ring) RPop(context interface{}, key string) *StringCmd
- func (c Ring) RPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Ring) RPopLPush(context interface{}, source, destination string) *StringCmd
- func (c Ring) RPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Ring) RPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Ring) RandomKey(context interface{}) *StringCmd
- func (c Ring) ReadOnly(context interface{}) *StatusCmd
- func (c Ring) ReadWrite(context interface{}) *StatusCmd
- func (c Ring) Rename(context interface{}, key, newkey string) *StatusCmd
- func (c Ring) RenameNX(context interface{}, key, newkey string) *BoolCmd
- func (c Ring) Restore(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Ring) RestoreReplace(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Ring) SAdd(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Ring) SCard(context interface{}, key string) *IntCmd
- func (c Ring) SDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Ring) SDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Ring) SInter(context interface{}, keys ...string) *StringSliceCmd
- func (c Ring) SInterStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Ring) SIsMember(context interface{}, key string, member interface{}) *BoolCmd
- func (c Ring) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
- func (c Ring) SMembers(context interface{}, key string) *StringSliceCmd
- func (c Ring) SMembersMap(context interface{}, key string) *StringStructMapCmd
- func (c Ring) SMove(context interface{}, source, destination string, member interface{}) *BoolCmd
- func (c Ring) SPop(context interface{}, key string) *StringCmd
- func (c Ring) SPopN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Ring) SRandMember(context interface{}, key string) *StringCmd
- func (c Ring) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Ring) SRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Ring) SScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) SUnion(context interface{}, keys ...string) *StringSliceCmd
- func (c Ring) SUnionStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Ring) Save(context interface{}) *StatusCmd
- func (c Ring) Scan(context interface{}, cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) ScanType(context interface{}, cursor uint64, match string, count int64, keyType string) *ScanCmd
- func (c Ring) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
- func (c Ring) ScriptFlush(context interface{}) *StatusCmd
- func (c Ring) ScriptKill(context interface{}) *StatusCmd
- func (c Ring) ScriptLoad(context interface{}, script string) *StringCmd
- func (c Ring) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Ring) SetArgs(context interface{}, key string, value interface{}, a SetArgs) *StatusCmd
- func (c Ring) SetBit(context interface{}, key string, offset int64, value int) *IntCmd
- func (c Ring) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Ring) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Ring) SetRange(context interface{}, key string, offset int64, value string) *IntCmd
- func (c Ring) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Ring) Shutdown(context interface{}) *StatusCmd
- func (c Ring) ShutdownNoSave(context interface{}) *StatusCmd
- func (c Ring) ShutdownSave(context interface{}) *StatusCmd
- func (c Ring) SlaveOf(context interface{}, host, port string) *StatusCmd
- func (c Ring) SlowLogGet(context interface{}, num int64) *SlowLogCmd
- func (c Ring) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
- func (c Ring) SortInterfaces(context interface{}, key string, sort *Sort) *SliceCmd
- func (c Ring) SortStore(context interface{}, key, store string, sort *Sort) *IntCmd
- func (c Ring) StrLen(context interface{}, key string) *IntCmd
- func (c *Ring) Subscribe(ctx context.Context, channels ...string) *PubSub
- func (c Ring) Sync(_ context.Context)
- func (c Ring) TTL(context interface{}, key string) *DurationCmd
- func (c Ring) Time(context interface{}) *TimeCmd
- func (c Ring) Touch(context interface{}, keys ...string) *IntCmd
- func (c *Ring) TxPipeline() Pipeliner
- func (c *Ring) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c Ring) Type(context interface{}, key string) *StatusCmd
- func (c Ring) Unlink(context interface{}, keys ...string) *IntCmd
- func (c Ring) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd
- func (c *Ring) Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error
- func (c *Ring) WithContext(ctx context.Context) *Ring
- func (c Ring) XAck(context interface{}, stream, group string, ids ...string) *IntCmd
- func (c Ring) XAdd(context interface{}, a *XAddArgs) *StringCmd
- func (c Ring) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
- func (c Ring) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
- func (c Ring) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
- func (c Ring) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
- func (c Ring) XDel(context interface{}, stream string, ids ...string) *IntCmd
- func (c Ring) XGroupCreate(context interface{}, stream, group, start string) *StatusCmd
- func (c Ring) XGroupCreateConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Ring) XGroupCreateMkStream(context interface{}, stream, group, start string) *StatusCmd
- func (c Ring) XGroupDelConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Ring) XGroupDestroy(context interface{}, stream, group string) *IntCmd
- func (c Ring) XGroupSetID(context interface{}, stream, group, start string) *StatusCmd
- func (c Ring) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
- func (c Ring) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
- func (c Ring) XInfoStream(context interface{}, key string) *XInfoStreamCmd
- func (c Ring) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
- func (c Ring) XLen(context interface{}, stream string) *IntCmd
- func (c Ring) XPending(context interface{}, stream, group string) *XPendingCmd
- func (c Ring) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
- func (c Ring) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Ring) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Ring) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
- func (c Ring) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
- func (c Ring) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
- func (c Ring) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Ring) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Ring) XTrim(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Ring) XTrimApprox(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Ring) XTrimMaxLen(context interface{}, key string, maxLen int64) *IntCmd
- func (c Ring) XTrimMaxLenApprox(context interface{}, key string, maxLen, limit int64) *IntCmd
- func (c Ring) XTrimMinID(context interface{}, key string, minID string) *IntCmd
- func (c Ring) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
- func (c Ring) ZAdd(context interface{}, key string, members ...*Z) *IntCmd
- func (c Ring) ZAddArgs(context interface{}, key string, args ZAddArgs) *IntCmd
- func (c Ring) ZAddArgsIncr(context interface{}, key string, args ZAddArgs) *FloatCmd
- func (c Ring) ZAddCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Ring) ZAddNX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Ring) ZAddNXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Ring) ZAddXX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Ring) ZAddXXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Ring) ZCard(context interface{}, key string) *IntCmd
- func (c Ring) ZCount(context interface{}, key, min, max string) *IntCmd
- func (c Ring) ZDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Ring) ZDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Ring) ZDiffWithScores(context interface{}, keys ...string) *ZSliceCmd
- func (c Ring) ZIncr(context interface{}, key string, member *Z) *FloatCmd
- func (c Ring) ZIncrBy(context interface{}, key string, increment float64, member string) *FloatCmd
- func (c Ring) ZIncrNX(context interface{}, key string, member *Z) *FloatCmd
- func (c Ring) ZIncrXX(context interface{}, key string, member *Z) *FloatCmd
- func (c Ring) ZInter(context interface{}, store *ZStore) *StringSliceCmd
- func (c Ring) ZInterStore(context interface{}, destination string, store *ZStore) *IntCmd
- func (c Ring) ZInterWithScores(context interface{}, store *ZStore) *ZSliceCmd
- func (c Ring) ZLexCount(context interface{}, key, min, max string) *IntCmd
- func (c Ring) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
- func (c Ring) ZPopMax(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Ring) ZPopMin(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Ring) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
- func (c Ring) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Ring) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
- func (c Ring) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
- func (c Ring) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Ring) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
- func (c Ring) ZRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Ring) ZRank(context interface{}, key, member string) *IntCmd
- func (c Ring) ZRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Ring) ZRemRangeByLex(context interface{}, key, min, max string) *IntCmd
- func (c Ring) ZRemRangeByRank(context interface{}, key string, start, stop int64) *IntCmd
- func (c Ring) ZRemRangeByScore(context interface{}, key, min, max string) *IntCmd
- func (c Ring) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Ring) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRevRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Ring) ZRevRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Ring) ZRevRank(context interface{}, key, member string) *IntCmd
- func (c Ring) ZScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) ZScore(context interface{}, key, member string) *FloatCmd
- func (c Ring) ZUnion(context interface{}, store ZStore) *StringSliceCmd
- func (c Ring) ZUnionStore(context interface{}, dest string, store *ZStore) *IntCmd
- func (c Ring) ZUnionWithScores(context interface{}, store ZStore) *ZSliceCmd
- type RingOptions
- type ScanCmd
- func (cmd *ScanCmd) Args() []interface{}
- func (cmd *ScanCmd) Err() error
- func (cmd *ScanCmd) FullName() string
- func (cmd *ScanCmd) Iterator() *ScanIterator
- func (cmd *ScanCmd) Name() string
- func (cmd *ScanCmd) Result() (keys []string, cursor uint64, err error)
- func (cmd *ScanCmd) SetErr(e error)
- func (cmd *ScanCmd) String() string
- func (cmd *ScanCmd) Val() (keys []string, cursor uint64)
- type ScanIterator
- type Script
- func (s *Script) Eval(ctx context.Context, c Scripter, keys []string, args ...interface{}) *Cmd
- func (s *Script) EvalSha(ctx context.Context, c Scripter, keys []string, args ...interface{}) *Cmd
- func (s *Script) Exists(ctx context.Context, c Scripter) *BoolSliceCmd
- func (s *Script) Hash() string
- func (s *Script) Load(ctx context.Context, c Scripter) *StringCmd
- func (s *Script) Run(ctx context.Context, c Scripter, keys []string, args ...interface{}) *Cmd
- type Scripter
- type SentinelClient
- func (hs *SentinelClient) AddHook(hook Hook)
- func (c *SentinelClient) CkQuorum(ctx context.Context, name string) *StringCmd
- func (c SentinelClient) Close() error
- func (c *SentinelClient) Context() context.Context
- func (c *SentinelClient) Failover(ctx context.Context, name string) *StatusCmd
- func (c *SentinelClient) FlushConfig(ctx context.Context) *StatusCmd
- func (c *SentinelClient) GetMasterAddrByName(ctx context.Context, name string) *StringSliceCmd
- func (c *SentinelClient) Master(ctx context.Context, name string) *StringStringMapCmd
- func (c *SentinelClient) Masters(ctx context.Context) *SliceCmd
- func (c *SentinelClient) Monitor(ctx context.Context, name, ip, port, quorum string) *StringCmd
- func (c *SentinelClient) PSubscribe(ctx context.Context, channels ...string) *PubSub
- func (c *SentinelClient) Ping(ctx context.Context) *StringCmd
- func (c *SentinelClient) Process(ctx context.Context, cmd Cmder) error
- func (c *SentinelClient) Remove(ctx context.Context, name string) *StringCmd
- func (c *SentinelClient) Reset(ctx context.Context, pattern string) *IntCmd
- func (c *SentinelClient) Sentinels(ctx context.Context, name string) *SliceCmd
- func (c *SentinelClient) Set(ctx context.Context, name, option, value string) *StringCmd
- func (c *SentinelClient) Slaves(ctx context.Context, name string) *SliceCmd
- func (c SentinelClient) String() string
- func (c *SentinelClient) Subscribe(ctx context.Context, channels ...string) *PubSub
- func (c *SentinelClient) WithContext(ctx context.Context) *SentinelClient
- type SetArgs
- type SliceCmd
- func (cmd *SliceCmd) Args() []interface{}
- func (cmd *SliceCmd) Err() error
- func (cmd *SliceCmd) FullName() string
- func (cmd *SliceCmd) Name() string
- func (cmd *SliceCmd) Result() ([]interface{}, error)
- func (cmd *SliceCmd) Scan(dst interface{}) error
- func (cmd *SliceCmd) SetErr(e error)
- func (cmd *SliceCmd) String() string
- func (cmd *SliceCmd) Val() []interface{}
- type SlowLog
- type SlowLogCmd
- func (cmd *SlowLogCmd) Args() []interface{}
- func (cmd *SlowLogCmd) Err() error
- func (cmd *SlowLogCmd) FullName() string
- func (cmd *SlowLogCmd) Name() string
- func (cmd *SlowLogCmd) Result() ([]SlowLog, error)
- func (cmd *SlowLogCmd) SetErr(e error)
- func (cmd *SlowLogCmd) String() string
- func (cmd *SlowLogCmd) Val() []SlowLog
- type Sort
- type StatefulCmdable
- type StatusCmd
- func (cmd *StatusCmd) Args() []interface{}
- func (cmd *StatusCmd) Err() error
- func (cmd *StatusCmd) FullName() string
- func (cmd *StatusCmd) Name() string
- func (cmd *StatusCmd) Result() (string, error)
- func (cmd *StatusCmd) SetErr(e error)
- func (cmd *StatusCmd) String() string
- func (cmd *StatusCmd) Val() string
- type StringCmd
- func (cmd *StringCmd) Args() []interface{}
- func (cmd *StringCmd) Bool() (bool, error)
- func (cmd *StringCmd) Bytes() ([]byte, error)
- func (cmd *StringCmd) Err() error
- func (cmd *StringCmd) Float32() (float32, error)
- func (cmd *StringCmd) Float64() (float64, error)
- func (cmd *StringCmd) FullName() string
- func (cmd *StringCmd) Int() (int, error)
- func (cmd *StringCmd) Int64() (int64, error)
- func (cmd *StringCmd) Name() string
- func (cmd *StringCmd) Result() (string, error)
- func (cmd *StringCmd) Scan(val interface{}) error
- func (cmd *StringCmd) SetErr(e error)
- func (cmd *StringCmd) String() string
- func (cmd *StringCmd) Time() (time.Time, error)
- func (cmd *StringCmd) Uint64() (uint64, error)
- func (cmd *StringCmd) Val() string
- type StringIntMapCmd
- func (cmd *StringIntMapCmd) Args() []interface{}
- func (cmd *StringIntMapCmd) Err() error
- func (cmd *StringIntMapCmd) FullName() string
- func (cmd *StringIntMapCmd) Name() string
- func (cmd *StringIntMapCmd) Result() (map[string]int64, error)
- func (cmd *StringIntMapCmd) SetErr(e error)
- func (cmd *StringIntMapCmd) String() string
- func (cmd *StringIntMapCmd) Val() map[string]int64
- type StringSliceCmd
- func (cmd *StringSliceCmd) Args() []interface{}
- func (cmd *StringSliceCmd) Err() error
- func (cmd *StringSliceCmd) FullName() string
- func (cmd *StringSliceCmd) Name() string
- func (cmd *StringSliceCmd) Result() ([]string, error)
- func (cmd *StringSliceCmd) ScanSlice(container interface{}) error
- func (cmd *StringSliceCmd) SetErr(e error)
- func (cmd *StringSliceCmd) String() string
- func (cmd *StringSliceCmd) Val() []string
- type StringStringMapCmd
- func (cmd *StringStringMapCmd) Args() []interface{}
- func (cmd *StringStringMapCmd) Err() error
- func (cmd *StringStringMapCmd) FullName() string
- func (cmd *StringStringMapCmd) Name() string
- func (cmd *StringStringMapCmd) Result() (map[string]string, error)
- func (cmd *StringStringMapCmd) Scan(dst interface{}) error
- func (cmd *StringStringMapCmd) SetErr(e error)
- func (cmd *StringStringMapCmd) String() string
- func (cmd *StringStringMapCmd) Val() map[string]string
- type StringStructMapCmd
- func (cmd *StringStructMapCmd) Args() []interface{}
- func (cmd *StringStructMapCmd) Err() error
- func (cmd *StringStructMapCmd) FullName() string
- func (cmd *StringStructMapCmd) Name() string
- func (cmd *StringStructMapCmd) Result() (map[string]struct{}, error)
- func (cmd *StringStructMapCmd) SetErr(e error)
- func (cmd *StringStructMapCmd) String() string
- func (cmd *StringStructMapCmd) Val() map[string]struct{}
- type Subscription
- type TimeCmd
- func (cmd *TimeCmd) Args() []interface{}
- func (cmd *TimeCmd) Err() error
- func (cmd *TimeCmd) FullName() string
- func (cmd *TimeCmd) Name() string
- func (cmd *TimeCmd) Result() (time.Time, error)
- func (cmd *TimeCmd) SetErr(e error)
- func (cmd *TimeCmd) String() string
- func (cmd *TimeCmd) Val() time.Time
- type Tx
- func (hs *Tx) AddHook(hook Hook)
- func (c Tx) Append(context interface{}, key, value string) *IntCmd
- func (c Tx) Auth(ctx context.Context, password string) *StatusCmd
- func (c Tx) AuthACL(ctx context.Context, username, password string) *StatusCmd
- func (c Tx) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Tx) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Tx) BRPopLPush(context interface{}, source, destination string, timeout time.Duration) *StringCmd
- func (c Tx) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Tx) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Tx) BgRewriteAOF(context interface{}) *StatusCmd
- func (c Tx) BgSave(context interface{}) *StatusCmd
- func (c Tx) BitCount(context interface{}, key string, bitCount *BitCount) *IntCmd
- func (c Tx) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
- func (c Tx) BitOpAnd(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Tx) BitOpNot(context interface{}, destKey string, key string) *IntCmd
- func (c Tx) BitOpOr(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Tx) BitOpXor(context interface{}, destKey string, keys ...string) *IntCmd
- func (c Tx) BitPos(context interface{}, key string, bit int64, pos ...int64) *IntCmd
- func (c Tx) ClientGetName(context interface{}) *StringCmd
- func (c Tx) ClientID(context interface{}) *IntCmd
- func (c Tx) ClientKill(context interface{}, ipPort string) *StatusCmd
- func (c Tx) ClientKillByFilter(context interface{}, keys ...string) *IntCmd
- func (c Tx) ClientList(context interface{}) *StringCmd
- func (c Tx) ClientPause(context interface{}, dur time.Duration) *BoolCmd
- func (c Tx) ClientSetName(ctx context.Context, name string) *BoolCmd
- func (c Tx) ClientUnblock(context interface{}, id int64) *IntCmd
- func (c Tx) ClientUnblockWithError(context interface{}, id int64) *IntCmd
- func (c *Tx) Close(ctx context.Context) error
- func (c Tx) ClusterAddSlots(context interface{}, slots ...int) *StatusCmd
- func (c Tx) ClusterAddSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Tx) ClusterCountFailureReports(context interface{}, nodeID string) *IntCmd
- func (c Tx) ClusterCountKeysInSlot(context interface{}, slot int) *IntCmd
- func (c Tx) ClusterDelSlots(context interface{}, slots ...int) *StatusCmd
- func (c Tx) ClusterDelSlotsRange(context interface{}, min, max int) *StatusCmd
- func (c Tx) ClusterFailover(context interface{}) *StatusCmd
- func (c Tx) ClusterForget(context interface{}, nodeID string) *StatusCmd
- func (c Tx) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
- func (c Tx) ClusterInfo(context interface{}) *StringCmd
- func (c Tx) ClusterKeySlot(context interface{}, key string) *IntCmd
- func (c Tx) ClusterMeet(context interface{}, host, port string) *StatusCmd
- func (c Tx) ClusterNodes(context interface{}) *StringCmd
- func (c Tx) ClusterReplicate(context interface{}, nodeID string) *StatusCmd
- func (c Tx) ClusterResetHard(context interface{}) *StatusCmd
- func (c Tx) ClusterResetSoft(context interface{}) *StatusCmd
- func (c Tx) ClusterSaveConfig(context interface{}) *StatusCmd
- func (c Tx) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
- func (c Tx) ClusterSlots(context interface{}) *ClusterSlotsCmd
- func (c Tx) Command(context interface{}) *CommandsInfoCmd
- func (c Tx) ConfigGet(context interface{}, parameter string) *SliceCmd
- func (c Tx) ConfigResetStat(context interface{}) *StatusCmd
- func (c Tx) ConfigRewrite(context interface{}) *StatusCmd
- func (c Tx) ConfigSet(context interface{}, parameter, value string) *StatusCmd
- func (c *Tx) Context() context.Context
- func (c Tx) DBSize(context interface{}) *IntCmd
- func (c Tx) DebugObject(context interface{}, key string) *StringCmd
- func (c Tx) Decr(context interface{}, key string) *IntCmd
- func (c Tx) DecrBy(context interface{}, key string, decrement int64) *IntCmd
- func (c Tx) Del(context interface{}, keys ...string) *IntCmd
- func (c Tx) Dump(context interface{}, key string) *StringCmd
- func (c Tx) Echo(context interface{}, message interface{}) *StringCmd
- func (c Tx) Eval(context interface{}, script string, keys []string, args ...interface{}) *Cmd
- func (c Tx) EvalSha(context interface{}, sha1 string, keys []string, args ...interface{}) *Cmd
- func (c Tx) Exists(context interface{}, keys ...string) *IntCmd
- func (c Tx) Expire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Tx) ExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Tx) FlushAll(context interface{}) *StatusCmd
- func (c Tx) FlushAllAsync(context interface{}) *StatusCmd
- func (c Tx) FlushDB(context interface{}) *StatusCmd
- func (c Tx) FlushDBAsync(context interface{}) *StatusCmd
- func (c Tx) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Tx) GeoDist(context interface{}, key string, member1, member2, unit string) *FloatCmd
- func (c Tx) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
- func (c Tx) GeoPos(context interface{}, key string, members ...string) *GeoPosCmd
- func (c Tx) GeoRadius(context interface{}, key string, longitude, latitude float64, ...) *GeoLocationCmd
- func (c Tx) GeoRadiusByMember(context interface{}, key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Tx) GeoRadiusByMemberStore(context interface{}, key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Tx) GeoRadiusStore(context interface{}, key string, longitude, latitude float64, ...) *IntCmd
- func (c Tx) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
- func (c Tx) GeoSearchLocation(context interface{}, key string, q *GeoSearchLocationQuery) *GeoSearchLocationCmd
- func (c Tx) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
- func (c Tx) Get(context interface{}, key string) *StringCmd
- func (c Tx) GetBit(context interface{}, key string, offset int64) *IntCmd
- func (c Tx) GetDel(context interface{}, key string) *StringCmd
- func (c Tx) GetEx(context interface{}, key string, expiration time.Duration) *StringCmd
- func (c Tx) GetRange(context interface{}, key string, start, end int64) *StringCmd
- func (c Tx) GetSet(context interface{}, key string, value interface{}) *StringCmd
- func (c Tx) HDel(context interface{}, key string, fields ...string) *IntCmd
- func (c Tx) HExists(context interface{}, key, field string) *BoolCmd
- func (c Tx) HGet(context interface{}, key, field string) *StringCmd
- func (c Tx) HGetAll(context interface{}, key string) *StringStringMapCmd
- func (c Tx) HIncrBy(context interface{}, key, field string, incr int64) *IntCmd
- func (c Tx) HIncrByFloat(context interface{}, key, field string, incr float64) *FloatCmd
- func (c Tx) HKeys(context interface{}, key string) *StringSliceCmd
- func (c Tx) HLen(context interface{}, key string) *IntCmd
- func (c Tx) HMGet(context interface{}, key string, fields ...string) *SliceCmd
- func (c Tx) HMSet(context interface{}, key string, values ...interface{}) *BoolCmd
- func (c Tx) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
- func (c Tx) HScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) HSet(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Tx) HSetNX(context interface{}, key, field string, value interface{}) *BoolCmd
- func (c Tx) HVals(context interface{}, key string) *StringSliceCmd
- func (c Tx) Incr(context interface{}, key string) *IntCmd
- func (c Tx) IncrBy(context interface{}, key string, value int64) *IntCmd
- func (c Tx) IncrByFloat(context interface{}, key string, value float64) *FloatCmd
- func (c Tx) Info(context interface{}, section ...string) *StringCmd
- func (c Tx) Keys(context interface{}, pattern string) *StringSliceCmd
- func (c Tx) LIndex(context interface{}, key string, index int64) *StringCmd
- func (c Tx) LInsert(context interface{}, key, op string, pivot, value interface{}) *IntCmd
- func (c Tx) LInsertAfter(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Tx) LInsertBefore(context interface{}, key string, pivot, value interface{}) *IntCmd
- func (c Tx) LLen(context interface{}, key string) *IntCmd
- func (c Tx) LMove(context interface{}, source, destination, srcpos, destpos string) *StringCmd
- func (c Tx) LPop(context interface{}, key string) *StringCmd
- func (c Tx) LPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Tx) LPos(context interface{}, key string, value string, a LPosArgs) *IntCmd
- func (c Tx) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
- func (c Tx) LPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Tx) LPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Tx) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Tx) LRem(context interface{}, key string, count int64, value interface{}) *IntCmd
- func (c Tx) LSet(context interface{}, key string, index int64, value interface{}) *StatusCmd
- func (c Tx) LTrim(context interface{}, key string, start, stop int64) *StatusCmd
- func (c Tx) LastSave(context interface{}) *IntCmd
- func (c Tx) MGet(context interface{}, keys ...string) *SliceCmd
- func (c Tx) MSet(context interface{}, values ...interface{}) *StatusCmd
- func (c Tx) MSetNX(context interface{}, values ...interface{}) *BoolCmd
- func (c Tx) MemoryUsage(context interface{}, key string, samples ...int) *IntCmd
- func (c Tx) Migrate(context interface{}, host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Tx) Move(context interface{}, key string, db int) *BoolCmd
- func (c Tx) ObjectEncoding(context interface{}, key string) *StringCmd
- func (c Tx) ObjectIdleTime(context interface{}, key string) *DurationCmd
- func (c Tx) ObjectRefCount(context interface{}, key string) *IntCmd
- func (c Tx) PExpire(context interface{}, key string, expiration time.Duration) *BoolCmd
- func (c Tx) PExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
- func (c Tx) PFAdd(context interface{}, key string, els ...interface{}) *IntCmd
- func (c Tx) PFCount(context interface{}, keys ...string) *IntCmd
- func (c Tx) PFMerge(context interface{}, dest string, keys ...string) *StatusCmd
- func (c Tx) PTTL(context interface{}, key string) *DurationCmd
- func (c Tx) Persist(context interface{}, key string) *BoolCmd
- func (c Tx) Ping(context interface{}) *StatusCmd
- func (c *Tx) Pipeline() Pipeliner
- func (c *Tx) Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Tx) Process(ctx context.Context, cmd Cmder) error
- func (c Tx) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
- func (c Tx) PubSubNumPat(context interface{}) *IntCmd
- func (c Tx) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
- func (c Tx) Publish(context interface{}, channel string, message interface{}) *IntCmd
- func (c Tx) Quit(ctx interface{}) *StatusCmd
- func (c Tx) RPop(context interface{}, key string) *StringCmd
- func (c Tx) RPopCount(context interface{}, key string, count int) *StringSliceCmd
- func (c Tx) RPopLPush(context interface{}, source, destination string) *StringCmd
- func (c Tx) RPush(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Tx) RPushX(context interface{}, key string, values ...interface{}) *IntCmd
- func (c Tx) RandomKey(context interface{}) *StringCmd
- func (c Tx) ReadOnly(context interface{}) *StatusCmd
- func (c Tx) ReadWrite(context interface{}) *StatusCmd
- func (c Tx) Rename(context interface{}, key, newkey string) *StatusCmd
- func (c Tx) RenameNX(context interface{}, key, newkey string) *BoolCmd
- func (c Tx) Restore(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Tx) RestoreReplace(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
- func (c Tx) SAdd(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Tx) SCard(context interface{}, key string) *IntCmd
- func (c Tx) SDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Tx) SDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Tx) SInter(context interface{}, keys ...string) *StringSliceCmd
- func (c Tx) SInterStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Tx) SIsMember(context interface{}, key string, member interface{}) *BoolCmd
- func (c Tx) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
- func (c Tx) SMembers(context interface{}, key string) *StringSliceCmd
- func (c Tx) SMembersMap(context interface{}, key string) *StringStructMapCmd
- func (c Tx) SMove(context interface{}, source, destination string, member interface{}) *BoolCmd
- func (c Tx) SPop(context interface{}, key string) *StringCmd
- func (c Tx) SPopN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Tx) SRandMember(context interface{}, key string) *StringCmd
- func (c Tx) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
- func (c Tx) SRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Tx) SScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) SUnion(context interface{}, keys ...string) *StringSliceCmd
- func (c Tx) SUnionStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Tx) Save(context interface{}) *StatusCmd
- func (c Tx) Scan(context interface{}, cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) ScanType(context interface{}, cursor uint64, match string, count int64, keyType string) *ScanCmd
- func (c Tx) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
- func (c Tx) ScriptFlush(context interface{}) *StatusCmd
- func (c Tx) ScriptKill(context interface{}) *StatusCmd
- func (c Tx) ScriptLoad(context interface{}, script string) *StringCmd
- func (c Tx) Select(ctx context.Context, index int) *StatusCmd
- func (c Tx) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Tx) SetArgs(context interface{}, key string, value interface{}, a SetArgs) *StatusCmd
- func (c Tx) SetBit(context interface{}, key string, offset int64, value int) *IntCmd
- func (c Tx) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Tx) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Tx) SetRange(context interface{}, key string, offset int64, value string) *IntCmd
- func (c Tx) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Tx) Shutdown(context interface{}) *StatusCmd
- func (c Tx) ShutdownNoSave(context interface{}) *StatusCmd
- func (c Tx) ShutdownSave(context interface{}) *StatusCmd
- func (c Tx) SlaveOf(context interface{}, host, port string) *StatusCmd
- func (c Tx) SlowLogGet(context interface{}, num int64) *SlowLogCmd
- func (c Tx) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
- func (c Tx) SortInterfaces(context interface{}, key string, sort *Sort) *SliceCmd
- func (c Tx) SortStore(context interface{}, key, store string, sort *Sort) *IntCmd
- func (c Tx) StrLen(context interface{}, key string) *IntCmd
- func (c *Tx) String() string
- func (c Tx) SwapDB(ctx context.Context, index1, index2 int) *StatusCmd
- func (c Tx) Sync(_ context.Context)
- func (c Tx) TTL(context interface{}, key string) *DurationCmd
- func (c Tx) Time(context interface{}) *TimeCmd
- func (c Tx) Touch(context interface{}, keys ...string) *IntCmd
- func (c *Tx) TxPipeline() Pipeliner
- func (c *Tx) TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
- func (c Tx) Type(context interface{}, key string) *StatusCmd
- func (c Tx) Unlink(context interface{}, keys ...string) *IntCmd
- func (c *Tx) Unwatch(ctx context.Context, keys ...string) *StatusCmd
- func (c Tx) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd
- func (c *Tx) Watch(ctx context.Context, keys ...string) *StatusCmd
- func (c *Tx) WithContext(ctx context.Context) *Tx
- func (c Tx) XAck(context interface{}, stream, group string, ids ...string) *IntCmd
- func (c Tx) XAdd(context interface{}, a *XAddArgs) *StringCmd
- func (c Tx) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
- func (c Tx) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
- func (c Tx) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
- func (c Tx) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
- func (c Tx) XDel(context interface{}, stream string, ids ...string) *IntCmd
- func (c Tx) XGroupCreate(context interface{}, stream, group, start string) *StatusCmd
- func (c Tx) XGroupCreateConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Tx) XGroupCreateMkStream(context interface{}, stream, group, start string) *StatusCmd
- func (c Tx) XGroupDelConsumer(context interface{}, stream, group, consumer string) *IntCmd
- func (c Tx) XGroupDestroy(context interface{}, stream, group string) *IntCmd
- func (c Tx) XGroupSetID(context interface{}, stream, group, start string) *StatusCmd
- func (c Tx) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
- func (c Tx) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
- func (c Tx) XInfoStream(context interface{}, key string) *XInfoStreamCmd
- func (c Tx) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
- func (c Tx) XLen(context interface{}, stream string) *IntCmd
- func (c Tx) XPending(context interface{}, stream, group string) *XPendingCmd
- func (c Tx) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
- func (c Tx) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Tx) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Tx) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
- func (c Tx) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
- func (c Tx) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
- func (c Tx) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
- func (c Tx) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Tx) XTrim(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Tx) XTrimApprox(context interface{}, key string, maxLen int64) *IntCmddeprecated
- func (c Tx) XTrimMaxLen(context interface{}, key string, maxLen int64) *IntCmd
- func (c Tx) XTrimMaxLenApprox(context interface{}, key string, maxLen, limit int64) *IntCmd
- func (c Tx) XTrimMinID(context interface{}, key string, minID string) *IntCmd
- func (c Tx) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
- func (c Tx) ZAdd(context interface{}, key string, members ...*Z) *IntCmd
- func (c Tx) ZAddArgs(context interface{}, key string, args ZAddArgs) *IntCmd
- func (c Tx) ZAddArgsIncr(context interface{}, key string, args ZAddArgs) *FloatCmd
- func (c Tx) ZAddCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Tx) ZAddNX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Tx) ZAddNXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Tx) ZAddXX(context interface{}, key string, members ...*Z) *IntCmd
- func (c Tx) ZAddXXCh(context interface{}, key string, members ...*Z) *IntCmd
- func (c Tx) ZCard(context interface{}, key string) *IntCmd
- func (c Tx) ZCount(context interface{}, key, min, max string) *IntCmd
- func (c Tx) ZDiff(context interface{}, keys ...string) *StringSliceCmd
- func (c Tx) ZDiffStore(context interface{}, destination string, keys ...string) *IntCmd
- func (c Tx) ZDiffWithScores(context interface{}, keys ...string) *ZSliceCmd
- func (c Tx) ZIncr(context interface{}, key string, member *Z) *FloatCmd
- func (c Tx) ZIncrBy(context interface{}, key string, increment float64, member string) *FloatCmd
- func (c Tx) ZIncrNX(context interface{}, key string, member *Z) *FloatCmd
- func (c Tx) ZIncrXX(context interface{}, key string, member *Z) *FloatCmd
- func (c Tx) ZInter(context interface{}, store *ZStore) *StringSliceCmd
- func (c Tx) ZInterStore(context interface{}, destination string, store *ZStore) *IntCmd
- func (c Tx) ZInterWithScores(context interface{}, store *ZStore) *ZSliceCmd
- func (c Tx) ZLexCount(context interface{}, key, min, max string) *IntCmd
- func (c Tx) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
- func (c Tx) ZPopMax(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Tx) ZPopMin(context interface{}, key string, count ...int64) *ZSliceCmd
- func (c Tx) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
- func (c Tx) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Tx) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
- func (c Tx) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
- func (c Tx) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Tx) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
- func (c Tx) ZRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Tx) ZRank(context interface{}, key, member string) *IntCmd
- func (c Tx) ZRem(context interface{}, key string, members ...interface{}) *IntCmd
- func (c Tx) ZRemRangeByLex(context interface{}, key, min, max string) *IntCmd
- func (c Tx) ZRemRangeByRank(context interface{}, key string, start, stop int64) *IntCmd
- func (c Tx) ZRemRangeByScore(context interface{}, key, min, max string) *IntCmd
- func (c Tx) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
- func (c Tx) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRevRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
- func (c Tx) ZRevRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
- func (c Tx) ZRevRank(context interface{}, key, member string) *IntCmd
- func (c Tx) ZScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) ZScore(context interface{}, key, member string) *FloatCmd
- func (c Tx) ZUnion(context interface{}, store ZStore) *StringSliceCmd
- func (c Tx) ZUnionStore(context interface{}, dest string, store *ZStore) *IntCmd
- func (c Tx) ZUnionWithScores(context interface{}, store ZStore) *ZSliceCmd
- type UniversalClient
- type UniversalOptions
- type XAddArgs
- type XAutoClaimArgs
- type XAutoClaimCmd
- func (cmd *XAutoClaimCmd) Args() []interface{}
- func (cmd *XAutoClaimCmd) Err() error
- func (cmd *XAutoClaimCmd) FullName() string
- func (cmd *XAutoClaimCmd) Name() string
- func (cmd *XAutoClaimCmd) Result() (messages []XMessage, start string, err error)
- func (cmd *XAutoClaimCmd) SetErr(e error)
- func (cmd *XAutoClaimCmd) String() string
- func (cmd *XAutoClaimCmd) Val() (messages []XMessage, start string)
- type XAutoClaimJustIDCmd
- func (cmd *XAutoClaimJustIDCmd) Args() []interface{}
- func (cmd *XAutoClaimJustIDCmd) Err() error
- func (cmd *XAutoClaimJustIDCmd) FullName() string
- func (cmd *XAutoClaimJustIDCmd) Name() string
- func (cmd *XAutoClaimJustIDCmd) Result() (ids []string, start string, err error)
- func (cmd *XAutoClaimJustIDCmd) SetErr(e error)
- func (cmd *XAutoClaimJustIDCmd) String() string
- func (cmd *XAutoClaimJustIDCmd) Val() (ids []string, start string)
- type XClaimArgs
- type XInfoConsumer
- type XInfoConsumersCmd
- func (cmd *XInfoConsumersCmd) Args() []interface{}
- func (cmd *XInfoConsumersCmd) Err() error
- func (cmd *XInfoConsumersCmd) FullName() string
- func (cmd *XInfoConsumersCmd) Name() string
- func (cmd *XInfoConsumersCmd) Result() ([]XInfoConsumer, error)
- func (cmd *XInfoConsumersCmd) SetErr(e error)
- func (cmd *XInfoConsumersCmd) String() string
- func (cmd *XInfoConsumersCmd) Val() []XInfoConsumer
- type XInfoGroup
- type XInfoGroupsCmd
- func (cmd *XInfoGroupsCmd) Args() []interface{}
- func (cmd *XInfoGroupsCmd) Err() error
- func (cmd *XInfoGroupsCmd) FullName() string
- func (cmd *XInfoGroupsCmd) Name() string
- func (cmd *XInfoGroupsCmd) Result() ([]XInfoGroup, error)
- func (cmd *XInfoGroupsCmd) SetErr(e error)
- func (cmd *XInfoGroupsCmd) String() string
- func (cmd *XInfoGroupsCmd) Val() []XInfoGroup
- type XInfoStream
- type XInfoStreamCmd
- func (cmd *XInfoStreamCmd) Args() []interface{}
- func (cmd *XInfoStreamCmd) Err() error
- func (cmd *XInfoStreamCmd) FullName() string
- func (cmd *XInfoStreamCmd) Name() string
- func (cmd *XInfoStreamCmd) Result() (*XInfoStream, error)
- func (cmd *XInfoStreamCmd) SetErr(e error)
- func (cmd *XInfoStreamCmd) String() string
- func (cmd *XInfoStreamCmd) Val() *XInfoStream
- type XInfoStreamConsumer
- type XInfoStreamConsumerPending
- type XInfoStreamFull
- type XInfoStreamFullCmd
- func (cmd *XInfoStreamFullCmd) Args() []interface{}
- func (cmd *XInfoStreamFullCmd) Err() error
- func (cmd *XInfoStreamFullCmd) FullName() string
- func (cmd *XInfoStreamFullCmd) Name() string
- func (cmd *XInfoStreamFullCmd) Result() (*XInfoStreamFull, error)
- func (cmd *XInfoStreamFullCmd) SetErr(e error)
- func (cmd *XInfoStreamFullCmd) String() string
- func (cmd *XInfoStreamFullCmd) Val() *XInfoStreamFull
- type XInfoStreamGroup
- type XInfoStreamGroupPending
- type XMessage
- type XMessageSliceCmd
- func (cmd *XMessageSliceCmd) Args() []interface{}
- func (cmd *XMessageSliceCmd) Err() error
- func (cmd *XMessageSliceCmd) FullName() string
- func (cmd *XMessageSliceCmd) Name() string
- func (cmd *XMessageSliceCmd) Result() ([]XMessage, error)
- func (cmd *XMessageSliceCmd) SetErr(e error)
- func (cmd *XMessageSliceCmd) String() string
- func (cmd *XMessageSliceCmd) Val() []XMessage
- type XPending
- type XPendingCmd
- func (cmd *XPendingCmd) Args() []interface{}
- func (cmd *XPendingCmd) Err() error
- func (cmd *XPendingCmd) FullName() string
- func (cmd *XPendingCmd) Name() string
- func (cmd *XPendingCmd) Result() (*XPending, error)
- func (cmd *XPendingCmd) SetErr(e error)
- func (cmd *XPendingCmd) String() string
- func (cmd *XPendingCmd) Val() *XPending
- type XPendingExt
- type XPendingExtArgs
- type XPendingExtCmd
- func (cmd *XPendingExtCmd) Args() []interface{}
- func (cmd *XPendingExtCmd) Err() error
- func (cmd *XPendingExtCmd) FullName() string
- func (cmd *XPendingExtCmd) Name() string
- func (cmd *XPendingExtCmd) Result() ([]XPendingExt, error)
- func (cmd *XPendingExtCmd) SetErr(e error)
- func (cmd *XPendingExtCmd) String() string
- func (cmd *XPendingExtCmd) Val() []XPendingExt
- type XReadArgs
- type XReadGroupArgs
- type XStream
- type XStreamSliceCmd
- func (cmd *XStreamSliceCmd) Args() []interface{}
- func (cmd *XStreamSliceCmd) Err() error
- func (cmd *XStreamSliceCmd) FullName() string
- func (cmd *XStreamSliceCmd) Name() string
- func (cmd *XStreamSliceCmd) Result() ([]XStream, error)
- func (cmd *XStreamSliceCmd) SetErr(e error)
- func (cmd *XStreamSliceCmd) String() string
- func (cmd *XStreamSliceCmd) Val() []XStream
- type Z
- type ZAddArgs
- type ZRangeArgs
- type ZRangeBy
- type ZSliceCmd
- func (cmd *ZSliceCmd) Args() []interface{}
- func (cmd *ZSliceCmd) Err() error
- func (cmd *ZSliceCmd) FullName() string
- func (cmd *ZSliceCmd) Name() string
- func (cmd *ZSliceCmd) Result() ([]Z, error)
- func (cmd *ZSliceCmd) SetErr(e error)
- func (cmd *ZSliceCmd) String() string
- func (cmd *ZSliceCmd) Val() []Z
- type ZStore
- type ZWithKey
- type ZWithKeyCmd
- func (cmd *ZWithKeyCmd) Args() []interface{}
- func (cmd *ZWithKeyCmd) Err() error
- func (cmd *ZWithKeyCmd) FullName() string
- func (cmd *ZWithKeyCmd) Name() string
- func (cmd *ZWithKeyCmd) Result() (*ZWithKey, error)
- func (cmd *ZWithKeyCmd) SetErr(e error)
- func (cmd *ZWithKeyCmd) String() string
- func (cmd *ZWithKeyCmd) Val() *ZWithKey
Examples ¶
- Package (CustomCommand)
- Package (CustomCommand2)
- Package (Instrumentation)
- Client
- Client.BLPop
- Client.Incr
- Client.Pipeline
- Client.Pipelined
- Client.Scan
- Client.ScanType
- Client.Set
- Client.SetEX
- Client.SlowLogGet
- Client.TxPipeline
- Client.TxPipelined
- Client.Watch
- Client.Watch (Instrumentation)
- Conn
- NewClient
- NewClusterClient
- NewClusterClient (ManualSetup)
- NewFailoverClient
- NewRing
- NewUniversalClient (Cluster)
- NewUniversalClient (Failover)
- NewUniversalClient (Simple)
- ParseURL
- Pipeline (Instrumentation)
- PubSub
- PubSub.Receive
- ScanCmd.Iterator
- ScanIterator
- Script
- SliceCmd.Scan
- StringStringMapCmd.Scan
Constants ¶
const KeepTTL = -1
KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error. For example:
rdb.Set(ctx, key, value, redis.KeepTTL)
const Nil = proto.Nil
Nil reply returned by Redis when key does not exist.
const TxFailedErr = proto.RedisError("redis: transaction failed")
TxFailedErr transaction redis failed.
Variables ¶
var ErrClosed = pool.ErrClosed
ErrClosed performs any operation on the closed client will return this error.
Functions ¶
Types ¶
type BoolCmd ¶
type BoolCmd struct {
// contains filtered or unexported fields
}
func NewBoolCmd ¶
func NewBoolResult ¶
NewBoolResult returns a BoolCmd initialised with val and err for testing.
type BoolSliceCmd ¶
type BoolSliceCmd struct {
// contains filtered or unexported fields
}
func NewBoolSliceCmd ¶
func NewBoolSliceCmd(ctx context.Context, args ...interface{}) *BoolSliceCmd
func NewBoolSliceResult ¶
func NewBoolSliceResult(val []bool, err error) *BoolSliceCmd
NewBoolSliceResult returns a BoolSliceCmd initialised with val and err for testing.
func (*BoolSliceCmd) Result ¶
func (cmd *BoolSliceCmd) Result() ([]bool, error)
func (*BoolSliceCmd) String ¶
func (cmd *BoolSliceCmd) String() string
func (*BoolSliceCmd) Val ¶
func (cmd *BoolSliceCmd) Val() []bool
type ChannelOption ¶
type ChannelOption func(c *channel)
func WithChannelHealthCheckInterval ¶
func WithChannelHealthCheckInterval(d time.Duration) ChannelOption
WithChannelHealthCheckInterval specifies the health check interval. PubSub will ping Redis Server if it does not receive any messages within the interval. To disable health check, use zero interval.
The default is 3 seconds.
func WithChannelSendTimeout ¶
func WithChannelSendTimeout(d time.Duration) ChannelOption
WithChannelSendTimeout specifies the channel send timeout after which the message is dropped.
The default is 60 seconds.
func WithChannelSize ¶
func WithChannelSize(size int) ChannelOption
WithChannelSize specifies the Go chan size that is used to buffer incoming messages.
The default is 100 messages.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Redis client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.
Example ¶
err := rdb.Set(ctx, "key", "value", 0).Err()
if err != nil {
panic(err)
}
val, err := rdb.Get(ctx, "key").Result()
if err != nil {
panic(err)
}
fmt.Println("key", val)
val2, err := rdb.Get(ctx, "missing_key").Result()
if err == redis.Nil {
fmt.Println("missing_key does not exist")
} else if err != nil {
panic(err)
} else {
fmt.Println("missing_key", val2)
}
Output: key value missing_key does not exist
func NewClient ¶
NewClient returns a client to the Redis Server specified by Options.
Example ¶
rdb := redis.NewClient(&redis.Options{
Addr: "localhost:6379", // use default Addr
Password: "", // no password set
DB: 0, // use default DB
})
pong, err := rdb.Ping(ctx).Result()
fmt.Println(pong, err)
Output: PONG <nil>
func NewFailoverClient ¶
func NewFailoverClient(failoverOpt *FailoverOptions) *Client
NewFailoverClient returns a Redis client that uses Redis Sentinel for automatic failover. It's safe for concurrent use by multiple goroutines.
Example ¶
// See http://redis.io/topics/sentinel for instructions how to
// setup Redis Sentinel.
rdb := redis.NewFailoverClient(&redis.FailoverOptions{
MasterName: "master",
SentinelAddrs: []string{":26379"},
})
rdb.Ping(ctx)
func (Client) BLPop ¶
func (c Client) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
Example ¶
if err := rdb.RPush(ctx, "queue", "message").Err(); err != nil {
panic(err)
}
// use `rdb.BLPop(0, "queue")` for infinite waiting time
result, err := rdb.BLPop(ctx, 1*time.Second, "queue").Result()
if err != nil {
panic(err)
}
fmt.Println(result[0], result[1])
Output: queue message
func (Client) BRPop ¶
func (c Client) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (Client) BRPopLPush ¶
func (Client) BZPopMax ¶
func (c Client) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.
func (Client) BZPopMin ¶
func (c Client) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.
func (Client) BgRewriteAOF ¶
func (c Client) BgRewriteAOF(context interface{}) *StatusCmd
func (Client) BitField ¶
func (c Client) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
func (Client) ClientGetName ¶
func (c Client) ClientGetName(context interface{}) *StringCmd
ClientGetName returns the name of the connection.
func (Client) ClientKill ¶
func (Client) ClientKillByFilter ¶
ClientKillByFilter is new style syntax, while the ClientKill is old
CLIENT KILL <option> [value] ... <option> [value]
func (Client) ClientList ¶
func (c Client) ClientList(context interface{}) *StringCmd
func (Client) ClientPause ¶
func (Client) ClientUnblock ¶
func (Client) ClientUnblockWithError ¶
func (Client) Close ¶
func (c Client) Close() error
Close closes the client, releasing any open resources.
It is rare to Close a Client, as the Client is meant to be long-lived and shared between many goroutines.
func (Client) ClusterAddSlots ¶
func (Client) ClusterAddSlotsRange ¶
func (Client) ClusterCountFailureReports ¶
func (Client) ClusterCountKeysInSlot ¶
func (Client) ClusterDelSlots ¶
func (Client) ClusterDelSlotsRange ¶
func (Client) ClusterFailover ¶
func (c Client) ClusterFailover(context interface{}) *StatusCmd
func (Client) ClusterForget ¶
func (Client) ClusterGetKeysInSlot ¶
func (c Client) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
func (Client) ClusterInfo ¶
func (c Client) ClusterInfo(context interface{}) *StringCmd
func (Client) ClusterKeySlot ¶
func (Client) ClusterMeet ¶
func (Client) ClusterNodes ¶
func (c Client) ClusterNodes(context interface{}) *StringCmd
func (Client) ClusterReplicate ¶
func (Client) ClusterResetHard ¶
func (c Client) ClusterResetHard(context interface{}) *StatusCmd
func (Client) ClusterResetSoft ¶
func (c Client) ClusterResetSoft(context interface{}) *StatusCmd
func (Client) ClusterSaveConfig ¶
func (c Client) ClusterSaveConfig(context interface{}) *StatusCmd
func (Client) ClusterSlaves ¶
func (c Client) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
func (Client) ClusterSlots ¶
func (c Client) ClusterSlots(context interface{}) *ClusterSlotsCmd
func (Client) Command ¶
func (c Client) Command(context interface{}) *CommandsInfoCmd
func (Client) ConfigResetStat ¶
func (c Client) ConfigResetStat(context interface{}) *StatusCmd
func (Client) ConfigRewrite ¶
func (c Client) ConfigRewrite(context interface{}) *StatusCmd
func (Client) DebugObject ¶
func (Client) FlushAllAsync ¶
func (c Client) FlushAllAsync(context interface{}) *StatusCmd
func (Client) FlushDBAsync ¶
func (c Client) FlushDBAsync(context interface{}) *StatusCmd
func (Client) GeoAdd ¶
func (c Client) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
func (Client) GeoHash ¶
func (c Client) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
func (Client) GeoRadius ¶
func (c Client) GeoRadius(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Client) GeoRadiusByMember ¶
func (c Client) GeoRadiusByMember(
context interface{}, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.
func (Client) GeoRadiusByMemberStore ¶
func (c Client) GeoRadiusByMemberStore(
context interface{}, key, member string, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Client) GeoRadiusStore ¶
func (c Client) GeoRadiusStore(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Client) GeoSearch ¶
func (c Client) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
func (Client) GeoSearchLocation ¶
func (c Client) GeoSearchLocation(
context interface{}, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd
func (Client) GeoSearchStore ¶
func (c Client) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
func (Client) Get ¶
Get Redis `GET key` command. It returns redis.Nil error when key does not exist.
func (Client) GetEx ¶
GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.
func (Client) HGetAll ¶
func (c Client) HGetAll(context interface{}, key string) *StringStringMapCmd
func (Client) HIncrByFloat ¶
func (Client) HKeys ¶
func (c Client) HKeys(context interface{}, key string) *StringSliceCmd
func (Client) HMGet ¶
HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.
func (Client) HRandField ¶
func (c Client) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
HRandField redis-server version >= 6.2.0.
func (Client) HSet ¶
HSet accepts values in following formats:
- HSet("myhash", "key1", "value1", "key2", "value2")
- HSet("myhash", []string{"key1", "value1", "key2", "value2"})
- HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it requires Redis v4 for multiple field/value pairs support.
func (Client) HVals ¶
func (c Client) HVals(context interface{}, key string) *StringSliceCmd
func (Client) Incr ¶
Example ¶
result, err := rdb.Incr(ctx, "counter").Result()
if err != nil {
panic(err)
}
fmt.Println(result)
Output: 1
func (Client) IncrByFloat ¶
func (Client) Keys ¶
func (c Client) Keys(context interface{}, pattern string) *StringSliceCmd
func (Client) LInsertAfter ¶
func (Client) LInsertBefore ¶
func (Client) LPopCount ¶
func (c Client) LPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Client) LPosCount ¶
func (c Client) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
func (Client) LRange ¶
func (c Client) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Client) MSet ¶
func (c Client) MSet(context interface{}, values ...interface{}) *StatusCmd
MSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Client) MSetNX ¶
func (c Client) MSetNX(context interface{}, values ...interface{}) *BoolCmd
MSetNX is like SetNX but accepts multiple values:
- MSetNX("key1", "value1", "key2", "value2")
- MSetNX([]string{"key1", "value1", "key2", "value2"})
- MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Client) MemoryUsage ¶
func (Client) ObjectEncoding ¶
func (Client) ObjectIdleTime ¶
func (c Client) ObjectIdleTime(context interface{}, key string) *DurationCmd
func (Client) ObjectRefCount ¶
func (*Client) PSubscribe ¶
PSubscribe subscribes the client to the given patterns. Patterns can be omitted to create empty subscription.
func (Client) PTTL ¶
func (c Client) PTTL(context interface{}, key string) *DurationCmd
func (*Client) Pipeline ¶
Example ¶
pipe := rdb.Pipeline() incr := pipe.Incr(ctx, "pipeline_counter") pipe.Expire(ctx, "pipeline_counter", time.Hour) // Execute // // INCR pipeline_counter // EXPIRE pipeline_counts 3600 // // using one rdb-server roundtrip. _, err := pipe.Exec(ctx) fmt.Println(incr.Val(), err)
Output: 1 <nil>
func (*Client) Pipelined ¶
Example ¶
var incr *redis.IntCmd
_, err := rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {
incr = pipe.Incr(ctx, "pipelined_counter")
pipe.Expire(ctx, "pipelined_counter", time.Hour)
return nil
})
fmt.Println(incr.Val(), err)
Output: 1 <nil>
func (Client) PubSubChannels ¶
func (c Client) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
func (Client) PubSubNumPat ¶
func (c Client) PubSubNumPat(context interface{}) *IntCmd
func (Client) PubSubNumSub ¶
func (c Client) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
func (Client) RPopCount ¶
func (c Client) RPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Client) RestoreReplace ¶
func (Client) SDiff ¶
func (c Client) SDiff(context interface{}, keys ...string) *StringSliceCmd
func (Client) SDiffStore ¶
func (Client) SInter ¶
func (c Client) SInter(context interface{}, keys ...string) *StringSliceCmd
func (Client) SInterStore ¶
func (Client) SMIsMember ¶
func (c Client) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
SMIsMember Redis `SMISMEMBER key member [member ...]` command.
func (Client) SMembers ¶
func (c Client) SMembers(context interface{}, key string) *StringSliceCmd
SMembers Redis `SMEMBERS key` command output as a slice.
func (Client) SMembersMap ¶
func (c Client) SMembersMap(context interface{}, key string) *StringStructMapCmd
SMembersMap Redis `SMEMBERS key` command output as a map.
func (Client) SPopN ¶
func (c Client) SPopN(context interface{}, key string, count int64) *StringSliceCmd
SPopN Redis `SPOP key count` command.
func (Client) SRandMember ¶
SRandMember Redis `SRANDMEMBER key` command.
func (Client) SRandMemberN ¶
func (c Client) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
SRandMemberN Redis `SRANDMEMBER key count` command.
func (Client) SUnion ¶
func (c Client) SUnion(context interface{}, keys ...string) *StringSliceCmd
func (Client) SUnionStore ¶
func (Client) Scan ¶
Example ¶
rdb.FlushDB(ctx)
for i := 0; i < 33; i++ {
err := rdb.Set(ctx, fmt.Sprintf("key%d", i), "value", 0).Err()
if err != nil {
panic(err)
}
}
var cursor uint64
var n int
for {
var keys []string
var err error
keys, cursor, err = rdb.Scan(ctx, cursor, "key*", 10).Result()
if err != nil {
panic(err)
}
n += len(keys)
if cursor == 0 {
break
}
}
fmt.Printf("found %d keys\n", n)
Output: found 33 keys
func (Client) ScanType ¶
func (c Client) ScanType(context interface{}, cursor uint64, match string, count int64, keyType string) *ScanCmd
Example ¶
rdb.FlushDB(ctx)
for i := 0; i < 33; i++ {
err := rdb.Set(ctx, fmt.Sprintf("key%d", i), "value", 0).Err()
if err != nil {
panic(err)
}
}
var cursor uint64
var n int
for {
var keys []string
var err error
keys, cursor, err = rdb.ScanType(ctx, cursor, "key*", 10, "string").Result()
if err != nil {
panic(err)
}
n += len(keys)
if cursor == 0 {
break
}
}
fmt.Printf("found %d keys\n", n)
Output: found 33 keys
func (Client) ScriptExists ¶
func (c Client) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
func (Client) ScriptFlush ¶
func (c Client) ScriptFlush(context interface{}) *StatusCmd
func (Client) ScriptKill ¶
func (c Client) ScriptKill(context interface{}) *StatusCmd
func (Client) ScriptLoad ¶
func (Client) Set ¶
func (c Client) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
Set Redis `SET key value [expiration]` command. Use expiration for `SETEX`-like behavior.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
Example ¶
// Last argument is expiration. Zero means the key has no
// expiration time.
err := rdb.Set(ctx, "key", "value", 0).Err()
if err != nil {
panic(err)
}
// key2 will expire in an hour.
err = rdb.Set(ctx, "key2", "value", time.Hour).Err()
if err != nil {
panic(err)
}
func (Client) SetArgs ¶
SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.
func (Client) SetEX ¶
func (c Client) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
SetEX Redis `SETEX key expiration value` command.
Example ¶
err := rdb.SetEX(ctx, "key", "value", time.Hour).Err()
if err != nil {
panic(err)
}
func (Client) SetNX ¶
func (c Client) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetNX Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Client) SetXX ¶
func (c Client) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetXX Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Client) ShutdownNoSave ¶
func (c Client) ShutdownNoSave(context interface{}) *StatusCmd
func (Client) ShutdownSave ¶
func (c Client) ShutdownSave(context interface{}) *StatusCmd
func (Client) SlowLogGet ¶
func (c Client) SlowLogGet(context interface{}, num int64) *SlowLogCmd
Example ¶
const key = "slowlog-log-slower-than"
old := rdb.ConfigGet(ctx, key).Val()
rdb.ConfigSet(ctx, key, "0")
defer rdb.ConfigSet(ctx, key, old[1].(string))
if err := rdb.Do(ctx, "slowlog", "reset").Err(); err != nil {
panic(err)
}
rdb.Set(ctx, "test", "true", 0)
result, err := rdb.SlowLogGet(ctx, -1).Result()
if err != nil {
panic(err)
}
fmt.Println(len(result))
Output: 2
func (Client) Sort ¶
func (c Client) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
func (Client) SortInterfaces ¶
func (*Client) Subscribe ¶
Subscribe subscribes the client to the specified channels. Channels can be omitted to create empty subscription. Note that this method does not wait on a response from Redis, so the subscription may not be active immediately. To force the connection to wait, you may call the Receive() method on the returned *PubSub like so:
sub := client.Subscribe(queryResp)
iface, err := sub.Receive()
if err != nil {
// handle error
}
// Should be *Subscription, but others are possible if other actions have been
// taken on sub since it was created.
switch iface.(type) {
case *Subscription:
// subscribe succeeded
case *Message:
// received first message
case *Pong:
// pong received
default:
// handle error
}
ch := sub.Channel()
func (Client) TTL ¶
func (c Client) TTL(context interface{}, key string) *DurationCmd
func (*Client) TxPipeline ¶
TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.
Example ¶
pipe := rdb.TxPipeline() incr := pipe.Incr(ctx, "tx_pipeline_counter") pipe.Expire(ctx, "tx_pipeline_counter", time.Hour) // Execute // // MULTI // INCR pipeline_counter // EXPIRE pipeline_counts 3600 // EXEC // // using one rdb-server roundtrip. _, err := pipe.Exec(ctx) fmt.Println(incr.Val(), err)
Output: 1 <nil>
func (*Client) TxPipelined ¶
Example ¶
var incr *redis.IntCmd
_, err := rdb.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
incr = pipe.Incr(ctx, "tx_pipelined_counter")
pipe.Expire(ctx, "tx_pipelined_counter", time.Hour)
return nil
})
fmt.Println(incr.Val(), err)
Output: 1 <nil>
func (*Client) Watch ¶
Watch prepares a transaction and marks the keys to be watched for conditional execution if there are any keys.
The transaction is automatically closed when fn exits.
Example ¶
const maxRetries = 1000
// Increment transactionally increments key using GET and SET commands.
increment := func(key string) error {
// Transactional function.
txf := func(tx *redis.Tx) error {
// Get current value or zero.
n, err := tx.Get(ctx, key).Int()
if err != nil && err != redis.Nil {
return err
}
// Actual opperation (local in optimistic lock).
n++
// Operation is committed only if the watched keys remain unchanged.
_, err = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
pipe.Set(ctx, key, n, 0)
return nil
})
return err
}
for i := 0; i < maxRetries; i++ {
err := rdb.Watch(ctx, txf, key)
if err == nil {
// Success.
return nil
}
if err == redis.TxFailedErr {
// Optimistic lock lost. Retry.
continue
}
// Return any other error.
return err
}
return errors.New("increment reached maximum number of retries")
}
var wg sync.WaitGroup
for i := 0; i < 100; i++ {
wg.Add(1)
go func() {
defer wg.Done()
if err := increment("counter3"); err != nil {
fmt.Println("increment error:", err)
}
}()
}
wg.Wait()
n, err := rdb.Get(ctx, "counter3").Int()
fmt.Println("ended with", n, err)
Output: ended with 100 <nil>
Example (Instrumentation) ¶
rdb := redis.NewClient(&redis.Options{
Addr: ":6379",
})
rdb.AddHook(redisHook{})
rdb.Watch(ctx, func(tx *redis.Tx) error {
tx.Ping(ctx)
tx.Ping(ctx)
return nil
}, "foo")
Output: starting processing: <watch foo: > finished processing: <watch foo: OK> starting processing: <ping: > finished processing: <ping: PONG> starting processing: <ping: > finished processing: <ping: PONG> starting processing: <unwatch: > finished processing: <unwatch: OK>
func (Client) XAdd ¶
XAdd a.Limit has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046
func (Client) XAutoClaim ¶
func (c Client) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
func (Client) XAutoClaimJustID ¶
func (c Client) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
func (Client) XClaim ¶
func (c Client) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
func (Client) XClaimJustID ¶
func (c Client) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
func (Client) XGroupCreate ¶
func (Client) XGroupCreateConsumer ¶
func (Client) XGroupCreateMkStream ¶
func (Client) XGroupDelConsumer ¶
func (Client) XGroupDestroy ¶
func (Client) XGroupSetID ¶
func (Client) XInfoConsumers ¶
func (c Client) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
func (Client) XInfoGroups ¶
func (c Client) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
func (Client) XInfoStream ¶
func (c Client) XInfoStream(context interface{}, key string) *XInfoStreamCmd
func (Client) XInfoStreamFull ¶
func (c Client) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
XInfoStreamFull XINFO STREAM FULL [COUNT count] redis-server >= 6.0.
func (Client) XPending ¶
func (c Client) XPending(context interface{}, stream, group string) *XPendingCmd
func (Client) XPendingExt ¶
func (c Client) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
func (Client) XRange ¶
func (c Client) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Client) XRangeN ¶
func (c Client) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Client) XRead ¶
func (c Client) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
func (Client) XReadGroup ¶
func (c Client) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
func (Client) XReadStreams ¶
func (c Client) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
func (Client) XRevRange ¶
func (c Client) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Client) XRevRangeN ¶
func (c Client) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Client) XTrimApprox
deprecated
func (Client) XTrimMaxLen ¶
XTrimMaxLen No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MAXLEN maxLen
func (Client) XTrimMaxLenApprox ¶
XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit
func (Client) XTrimMinID ¶
XTrimMinID No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MINID minID
func (Client) XTrimMinIDApprox ¶
func (c Client) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
XTrimMinIDApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MINID ~ minID LIMIT limit
func (Client) ZAddArgsIncr ¶
func (Client) ZAddCh ¶
ZAddCh Redis `ZADD key CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
Ch: true,
Members: []Z,
})
remove in v9.
func (Client) ZAddNXCh ¶
ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
NX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Client) ZAddXXCh ¶
ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
XX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Client) ZDiff ¶
func (c Client) ZDiff(context interface{}, keys ...string) *StringSliceCmd
ZDiff redis-server version >= 6.2.0.
func (Client) ZDiffStore ¶
ZDiffStore redis-server version >=6.2.0.
func (Client) ZDiffWithScores ¶
ZDiffWithScores redis-server version >= 6.2.0.
func (Client) ZIncr ¶
ZIncr Redis `ZADD key INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
Members: []Z,
})
remove in v9.
func (Client) ZIncrNX ¶
ZIncrNX Redis `ZADD key NX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
NX: true,
Members: []Z,
})
remove in v9.
func (Client) ZIncrXX ¶
ZIncrXX Redis `ZADD key XX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
XX: true,
Members: []Z,
})
remove in v9.
func (Client) ZInter ¶
func (c Client) ZInter(context interface{}, store *ZStore) *StringSliceCmd
func (Client) ZInterStore ¶
func (Client) ZInterWithScores ¶
func (Client) ZMScore ¶
func (c Client) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
func (Client) ZRandMember ¶
func (c Client) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
ZRandMember redis-server version >= 6.2.0.
func (Client) ZRange ¶
func (c Client) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Client) ZRangeArgs ¶
func (c Client) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
func (Client) ZRangeArgsWithScores ¶
func (c Client) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
func (Client) ZRangeByLex ¶
func (c Client) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRangeByScore ¶
func (c Client) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRangeByScoreWithScores ¶
func (Client) ZRangeStore ¶
func (c Client) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
func (Client) ZRangeWithScores ¶
func (Client) ZRemRangeByLex ¶
func (Client) ZRemRangeByRank ¶
func (Client) ZRemRangeByScore ¶
func (Client) ZRevRange ¶
func (c Client) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Client) ZRevRangeByLex ¶
func (c Client) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRevRangeByScore ¶
func (c Client) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRevRangeByScoreWithScores ¶
func (Client) ZRevRangeWithScores ¶
func (Client) ZUnion ¶
func (c Client) ZUnion(context interface{}, store ZStore) *StringSliceCmd
func (Client) ZUnionStore ¶
func (Client) ZUnionWithScores ¶
type ClusterClient ¶
type ClusterClient struct {
// contains filtered or unexported fields
}
ClusterClient is a Redis Cluster client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.
func NewClusterClient ¶
func NewClusterClient(opt *ClusterOptions) *ClusterClient
NewClusterClient returns a Redis Cluster client as described in http://redis.io/topics/cluster-spec.
Example ¶
// See http://redis.io/topics/cluster-tutorial for instructions
// how to setup Redis Cluster.
rdb := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},
})
rdb.Ping(ctx)
Example (ManualSetup) ¶
Following example creates a cluster from 2 master nodes and 2 slave nodes without using cluster mode or Redis Sentinel.
// clusterSlots returns cluster slots information.
// It can use service like ZooKeeper to maintain configuration information
// and Cluster.ReloadState to manually trigger state reloading.
clusterSlots := func(ctx context.Context) ([]redis.ClusterSlot, error) {
slots := []redis.ClusterSlot{
// First node with 1 master and 1 slave.
{
Start: 0,
End: 8191,
Nodes: []redis.ClusterNode{{
Addr: ":7000", // master
}, {
Addr: ":8000", // 1st slave
}},
},
// Second node with 1 master and 1 slave.
{
Start: 8192,
End: 16383,
Nodes: []redis.ClusterNode{{
Addr: ":7001", // master
}, {
Addr: ":8001", // 1st slave
}},
},
}
return slots, nil
}
rdb := redis.NewClusterClient(&redis.ClusterOptions{
ClusterSlots: clusterSlots,
RouteRandomly: true,
})
rdb.Ping(ctx)
// ReloadState reloads cluster state. It calls ClusterSlots func
// to get cluster slots information.
rdb.ReloadState(ctx)
func NewFailoverClusterClient ¶
func NewFailoverClusterClient(failoverOpt *FailoverOptions) *ClusterClient
NewFailoverClusterClient returns a client that supports routing read-only commands to a slave node.
func (ClusterClient) BLPop ¶
func (c ClusterClient) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (ClusterClient) BRPop ¶
func (c ClusterClient) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (ClusterClient) BRPopLPush ¶
func (ClusterClient) BZPopMax ¶
func (c ClusterClient) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.
func (ClusterClient) BZPopMin ¶
func (c ClusterClient) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.
func (ClusterClient) BgRewriteAOF ¶
func (c ClusterClient) BgRewriteAOF(context interface{}) *StatusCmd
func (ClusterClient) BitField ¶
func (c ClusterClient) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
func (ClusterClient) ClientGetName ¶
func (c ClusterClient) ClientGetName(context interface{}) *StringCmd
ClientGetName returns the name of the connection.
func (ClusterClient) ClientKill ¶
func (ClusterClient) ClientKillByFilter ¶
ClientKillByFilter is new style syntax, while the ClientKill is old
CLIENT KILL <option> [value] ... <option> [value]
func (ClusterClient) ClientList ¶
func (c ClusterClient) ClientList(context interface{}) *StringCmd
func (ClusterClient) ClientPause ¶
func (ClusterClient) ClientUnblock ¶
func (ClusterClient) ClientUnblockWithError ¶
func (*ClusterClient) Close ¶
func (c *ClusterClient) Close() error
Close closes the cluster client, releasing any open resources.
It is rare to Close a ClusterClient, as the ClusterClient is meant to be long-lived and shared between many goroutines.
func (ClusterClient) ClusterAddSlots ¶
func (ClusterClient) ClusterAddSlotsRange ¶
func (ClusterClient) ClusterCountFailureReports ¶
func (ClusterClient) ClusterCountKeysInSlot ¶
func (ClusterClient) ClusterDelSlots ¶
func (ClusterClient) ClusterDelSlotsRange ¶
func (ClusterClient) ClusterFailover ¶
func (c ClusterClient) ClusterFailover(context interface{}) *StatusCmd
func (ClusterClient) ClusterForget ¶
func (ClusterClient) ClusterGetKeysInSlot ¶
func (c ClusterClient) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
func (ClusterClient) ClusterInfo ¶
func (c ClusterClient) ClusterInfo(context interface{}) *StringCmd
func (ClusterClient) ClusterKeySlot ¶
func (ClusterClient) ClusterMeet ¶
func (ClusterClient) ClusterNodes ¶
func (c ClusterClient) ClusterNodes(context interface{}) *StringCmd
func (ClusterClient) ClusterReplicate ¶
func (ClusterClient) ClusterResetHard ¶
func (c ClusterClient) ClusterResetHard(context interface{}) *StatusCmd
func (ClusterClient) ClusterResetSoft ¶
func (c ClusterClient) ClusterResetSoft(context interface{}) *StatusCmd
func (ClusterClient) ClusterSaveConfig ¶
func (c ClusterClient) ClusterSaveConfig(context interface{}) *StatusCmd
func (ClusterClient) ClusterSlaves ¶
func (c ClusterClient) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
func (ClusterClient) ClusterSlots ¶
func (c ClusterClient) ClusterSlots(context interface{}) *ClusterSlotsCmd
func (ClusterClient) Command ¶
func (c ClusterClient) Command(context interface{}) *CommandsInfoCmd
func (ClusterClient) ConfigResetStat ¶
func (c ClusterClient) ConfigResetStat(context interface{}) *StatusCmd
func (ClusterClient) ConfigRewrite ¶
func (c ClusterClient) ConfigRewrite(context interface{}) *StatusCmd
func (*ClusterClient) Context ¶
func (c *ClusterClient) Context() context.Context
func (*ClusterClient) DBSize ¶
func (c *ClusterClient) DBSize(jCtx interface{}) *IntCmd
func (ClusterClient) DebugObject ¶
func (*ClusterClient) Do ¶
func (c *ClusterClient) Do(ctx context.Context, args ...interface{}) *Cmd
Do creates a Cmd from the args and processes the cmd.
func (ClusterClient) Echo ¶
func (c ClusterClient) Echo(context interface{}, message interface{}) *StringCmd
func (ClusterClient) FlushAllAsync ¶
func (c ClusterClient) FlushAllAsync(context interface{}) *StatusCmd
func (ClusterClient) FlushDBAsync ¶
func (c ClusterClient) FlushDBAsync(context interface{}) *StatusCmd
func (*ClusterClient) ForEachMaster ¶
func (c *ClusterClient) ForEachMaster( ctx context.Context, fn func(ctx context.Context, client *Client) error, ) error
ForEachMaster concurrently calls the fn on each master node in the cluster. It returns the first error if any.
func (*ClusterClient) ForEachShard ¶
func (c *ClusterClient) ForEachShard( ctx context.Context, fn func(ctx context.Context, client *Client) error, ) error
ForEachShard concurrently calls the fn on each known node in the cluster. It returns the first error if any.
func (*ClusterClient) ForEachSlave ¶
func (c *ClusterClient) ForEachSlave( ctx context.Context, fn func(ctx context.Context, client *Client) error, ) error
ForEachSlave concurrently calls the fn on each slave node in the cluster. It returns the first error if any.
func (ClusterClient) GeoAdd ¶
func (c ClusterClient) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
func (ClusterClient) GeoHash ¶
func (c ClusterClient) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
func (ClusterClient) GeoRadius ¶
func (c ClusterClient) GeoRadius(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (ClusterClient) GeoRadiusByMember ¶
func (c ClusterClient) GeoRadiusByMember(
context interface{}, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.
func (ClusterClient) GeoRadiusByMemberStore ¶
func (c ClusterClient) GeoRadiusByMemberStore(
context interface{}, key, member string, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (ClusterClient) GeoRadiusStore ¶
func (c ClusterClient) GeoRadiusStore(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (ClusterClient) GeoSearch ¶
func (c ClusterClient) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
func (ClusterClient) GeoSearchLocation ¶
func (c ClusterClient) GeoSearchLocation(
context interface{}, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd
func (ClusterClient) GeoSearchStore ¶
func (c ClusterClient) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
func (ClusterClient) Get ¶
Get Redis `GET key` command. It returns redis.Nil error when key does not exist.
func (ClusterClient) GetEx ¶
GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.
func (ClusterClient) HGetAll ¶
func (c ClusterClient) HGetAll(context interface{}, key string) *StringStringMapCmd
func (ClusterClient) HIncrByFloat ¶
func (ClusterClient) HKeys ¶
func (c ClusterClient) HKeys(context interface{}, key string) *StringSliceCmd
func (ClusterClient) HMGet ¶
HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.
func (ClusterClient) HMSet ¶
HMSet is a deprecated version of HSet left for compatibility with Redis 3.
func (ClusterClient) HRandField ¶
func (c ClusterClient) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
HRandField redis-server version >= 6.2.0.
func (ClusterClient) HSet ¶
HSet accepts values in following formats:
- HSet("myhash", "key1", "value1", "key2", "value2")
- HSet("myhash", []string{"key1", "value1", "key2", "value2"})
- HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it requires Redis v4 for multiple field/value pairs support.
func (ClusterClient) HVals ¶
func (c ClusterClient) HVals(context interface{}, key string) *StringSliceCmd
func (ClusterClient) IncrByFloat ¶
func (ClusterClient) Keys ¶
func (c ClusterClient) Keys(context interface{}, pattern string) *StringSliceCmd
func (ClusterClient) LInsertAfter ¶
func (ClusterClient) LInsertBefore ¶
func (ClusterClient) LPopCount ¶
func (c ClusterClient) LPopCount(context interface{}, key string, count int) *StringSliceCmd
func (ClusterClient) LPosCount ¶
func (c ClusterClient) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
func (ClusterClient) LRange ¶
func (c ClusterClient) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (ClusterClient) MSet ¶
func (c ClusterClient) MSet(context interface{}, values ...interface{}) *StatusCmd
MSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (ClusterClient) MSetNX ¶
func (c ClusterClient) MSetNX(context interface{}, values ...interface{}) *BoolCmd
MSetNX is like SetNX but accepts multiple values:
- MSetNX("key1", "value1", "key2", "value2")
- MSetNX([]string{"key1", "value1", "key2", "value2"})
- MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (*ClusterClient) MasterForKey ¶
MasterForKey return a client to the master node for a particular key.
func (ClusterClient) MemoryUsage ¶
func (ClusterClient) ObjectEncoding ¶
func (ClusterClient) ObjectIdleTime ¶
func (c ClusterClient) ObjectIdleTime(context interface{}, key string) *DurationCmd
func (ClusterClient) ObjectRefCount ¶
func (*ClusterClient) Options ¶
func (c *ClusterClient) Options() *ClusterOptions
Options returns read-only Options that were used to create the client.
func (*ClusterClient) PSubscribe ¶
func (c *ClusterClient) PSubscribe(ctx context.Context, channels ...string) *PubSub
PSubscribe subscribes the client to the given patterns. Patterns can be omitted to create empty subscription.
func (ClusterClient) PTTL ¶
func (c ClusterClient) PTTL(context interface{}, key string) *DurationCmd
func (*ClusterClient) Pipeline ¶
func (c *ClusterClient) Pipeline() Pipeliner
func (*ClusterClient) PoolStats ¶
func (c *ClusterClient) PoolStats() *PoolStats
PoolStats returns accumulated connection pool stats.
func (*ClusterClient) Process ¶
func (c *ClusterClient) Process(ctx context.Context, cmd Cmder) error
func (ClusterClient) PubSubChannels ¶
func (c ClusterClient) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
func (ClusterClient) PubSubNumPat ¶
func (c ClusterClient) PubSubNumPat(context interface{}) *IntCmd
func (ClusterClient) PubSubNumSub ¶
func (c ClusterClient) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
func (ClusterClient) RPopCount ¶
func (c ClusterClient) RPopCount(context interface{}, key string, count int) *StringSliceCmd
func (*ClusterClient) ReloadState ¶
func (c *ClusterClient) ReloadState(ctx context.Context)
ReloadState reloads cluster state. If available it calls ClusterSlots func to get cluster slots information.
func (ClusterClient) RestoreReplace ¶
func (ClusterClient) SDiff ¶
func (c ClusterClient) SDiff(context interface{}, keys ...string) *StringSliceCmd
func (ClusterClient) SDiffStore ¶
func (ClusterClient) SInter ¶
func (c ClusterClient) SInter(context interface{}, keys ...string) *StringSliceCmd
func (ClusterClient) SInterStore ¶
func (ClusterClient) SMIsMember ¶
func (c ClusterClient) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
SMIsMember Redis `SMISMEMBER key member [member ...]` command.
func (ClusterClient) SMembers ¶
func (c ClusterClient) SMembers(context interface{}, key string) *StringSliceCmd
SMembers Redis `SMEMBERS key` command output as a slice.
func (ClusterClient) SMembersMap ¶
func (c ClusterClient) SMembersMap(context interface{}, key string) *StringStructMapCmd
SMembersMap Redis `SMEMBERS key` command output as a map.
func (ClusterClient) SPopN ¶
func (c ClusterClient) SPopN(context interface{}, key string, count int64) *StringSliceCmd
SPopN Redis `SPOP key count` command.
func (ClusterClient) SRandMember ¶
SRandMember Redis `SRANDMEMBER key` command.
func (ClusterClient) SRandMemberN ¶
func (c ClusterClient) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
SRandMemberN Redis `SRANDMEMBER key count` command.
func (ClusterClient) SUnion ¶
func (c ClusterClient) SUnion(context interface{}, keys ...string) *StringSliceCmd
func (ClusterClient) SUnionStore ¶
func (*ClusterClient) ScriptExists ¶
func (c *ClusterClient) ScriptExists(jctx interface{}, hashes ...string) *BoolSliceCmd
func (*ClusterClient) ScriptFlush ¶
func (c *ClusterClient) ScriptFlush(jCtx interface{}) *StatusCmd
func (ClusterClient) ScriptKill ¶
func (c ClusterClient) ScriptKill(context interface{}) *StatusCmd
func (*ClusterClient) ScriptLoad ¶
func (c *ClusterClient) ScriptLoad(jctx interface{}, script string) *StringCmd
func (ClusterClient) Set ¶
func (c ClusterClient) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
Set Redis `SET key value [expiration]` command. Use expiration for `SETEX`-like behavior.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (ClusterClient) SetArgs ¶
func (c ClusterClient) SetArgs(context interface{}, key string, value interface{}, a SetArgs) *StatusCmd
SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.
func (ClusterClient) SetEX ¶
func (c ClusterClient) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
SetEX Redis `SETEX key expiration value` command.
func (ClusterClient) SetNX ¶
func (c ClusterClient) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetNX Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (ClusterClient) SetXX ¶
func (c ClusterClient) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetXX Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (ClusterClient) ShutdownNoSave ¶
func (c ClusterClient) ShutdownNoSave(context interface{}) *StatusCmd
func (ClusterClient) ShutdownSave ¶
func (c ClusterClient) ShutdownSave(context interface{}) *StatusCmd
func (*ClusterClient) SlaveForKey ¶
SlaveForKey gets a client for a replica node to run any command on it. This is especially useful if we want to run a particular lua script which has only read only commands on the replica. This is because other redis commands generally have a flag that points that they are read only and automatically run on the replica nodes if ClusterOptions.ReadOnly flag is set to true.
func (ClusterClient) SlowLogGet ¶
func (c ClusterClient) SlowLogGet(context interface{}, num int64) *SlowLogCmd
func (ClusterClient) Sort ¶
func (c ClusterClient) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
func (ClusterClient) SortInterfaces ¶
func (*ClusterClient) Subscribe ¶
func (c *ClusterClient) Subscribe(ctx context.Context, channels ...string) *PubSub
Subscribe subscribes the client to the specified channels. Channels can be omitted to create empty subscription.
func (ClusterClient) TTL ¶
func (c ClusterClient) TTL(context interface{}, key string) *DurationCmd
func (*ClusterClient) TxPipeline ¶
func (c *ClusterClient) TxPipeline() Pipeliner
TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.
func (*ClusterClient) TxPipelined ¶
func (*ClusterClient) WithContext ¶
func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient
func (ClusterClient) XAdd ¶
XAdd a.Limit has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046
func (ClusterClient) XAutoClaim ¶
func (c ClusterClient) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
func (ClusterClient) XAutoClaimJustID ¶
func (c ClusterClient) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
func (ClusterClient) XClaim ¶
func (c ClusterClient) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
func (ClusterClient) XClaimJustID ¶
func (c ClusterClient) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
func (ClusterClient) XGroupCreate ¶
func (ClusterClient) XGroupCreateConsumer ¶
func (ClusterClient) XGroupCreateMkStream ¶
func (ClusterClient) XGroupDelConsumer ¶
func (ClusterClient) XGroupDestroy ¶
func (ClusterClient) XGroupSetID ¶
func (ClusterClient) XInfoConsumers ¶
func (c ClusterClient) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
func (ClusterClient) XInfoGroups ¶
func (c ClusterClient) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
func (ClusterClient) XInfoStream ¶
func (c ClusterClient) XInfoStream(context interface{}, key string) *XInfoStreamCmd
func (ClusterClient) XInfoStreamFull ¶
func (c ClusterClient) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
XInfoStreamFull XINFO STREAM FULL [COUNT count] redis-server >= 6.0.
func (ClusterClient) XPending ¶
func (c ClusterClient) XPending(context interface{}, stream, group string) *XPendingCmd
func (ClusterClient) XPendingExt ¶
func (c ClusterClient) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
func (ClusterClient) XRange ¶
func (c ClusterClient) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (ClusterClient) XRangeN ¶
func (c ClusterClient) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (ClusterClient) XRead ¶
func (c ClusterClient) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
func (ClusterClient) XReadGroup ¶
func (c ClusterClient) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
func (ClusterClient) XReadStreams ¶
func (c ClusterClient) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
func (ClusterClient) XRevRange ¶
func (c ClusterClient) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (ClusterClient) XRevRangeN ¶
func (c ClusterClient) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (ClusterClient) XTrimApprox
deprecated
func (ClusterClient) XTrimMaxLen ¶
XTrimMaxLen No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MAXLEN maxLen
func (ClusterClient) XTrimMaxLenApprox ¶
func (c ClusterClient) XTrimMaxLenApprox(context interface{}, key string, maxLen, limit int64) *IntCmd
XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit
func (ClusterClient) XTrimMinID ¶
XTrimMinID No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MINID minID
func (ClusterClient) XTrimMinIDApprox ¶
func (c ClusterClient) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
XTrimMinIDApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MINID ~ minID LIMIT limit
func (ClusterClient) ZAddArgsIncr ¶
func (ClusterClient) ZAddCh ¶
ZAddCh Redis `ZADD key CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
Ch: true,
Members: []Z,
})
remove in v9.
func (ClusterClient) ZAddNXCh ¶
ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
NX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (ClusterClient) ZAddXXCh ¶
ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
XX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (ClusterClient) ZDiff ¶
func (c ClusterClient) ZDiff(context interface{}, keys ...string) *StringSliceCmd
ZDiff redis-server version >= 6.2.0.
func (ClusterClient) ZDiffStore ¶
ZDiffStore redis-server version >=6.2.0.
func (ClusterClient) ZDiffWithScores ¶
ZDiffWithScores redis-server version >= 6.2.0.
func (ClusterClient) ZIncr ¶
ZIncr Redis `ZADD key INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
Members: []Z,
})
remove in v9.
func (ClusterClient) ZIncrNX ¶
ZIncrNX Redis `ZADD key NX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
NX: true,
Members: []Z,
})
remove in v9.
func (ClusterClient) ZIncrXX ¶
ZIncrXX Redis `ZADD key XX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
XX: true,
Members: []Z,
})
remove in v9.
func (ClusterClient) ZInter ¶
func (c ClusterClient) ZInter(context interface{}, store *ZStore) *StringSliceCmd
func (ClusterClient) ZInterStore ¶
func (ClusterClient) ZInterWithScores ¶
func (ClusterClient) ZMScore ¶
func (c ClusterClient) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
func (ClusterClient) ZRandMember ¶
func (c ClusterClient) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
ZRandMember redis-server version >= 6.2.0.
func (ClusterClient) ZRange ¶
func (c ClusterClient) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (ClusterClient) ZRangeArgs ¶
func (c ClusterClient) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
func (ClusterClient) ZRangeArgsWithScores ¶
func (c ClusterClient) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
func (ClusterClient) ZRangeByLex ¶
func (c ClusterClient) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRangeByScore ¶
func (c ClusterClient) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRangeByScoreWithScores ¶
func (ClusterClient) ZRangeStore ¶
func (c ClusterClient) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
func (ClusterClient) ZRangeWithScores ¶
func (ClusterClient) ZRemRangeByLex ¶
func (ClusterClient) ZRemRangeByRank ¶
func (ClusterClient) ZRemRangeByScore ¶
func (ClusterClient) ZRevRange ¶
func (c ClusterClient) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (ClusterClient) ZRevRangeByLex ¶
func (c ClusterClient) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRevRangeByScore ¶
func (c ClusterClient) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRevRangeByScoreWithScores ¶
func (ClusterClient) ZRevRangeWithScores ¶
func (ClusterClient) ZUnion ¶
func (c ClusterClient) ZUnion(context interface{}, store ZStore) *StringSliceCmd
func (ClusterClient) ZUnionStore ¶
func (ClusterClient) ZUnionWithScores ¶
type ClusterNode ¶
type ClusterOptions ¶
type ClusterOptions struct {
// A seed list of host:port addresses of cluster nodes.
Addrs []string
// NewClient creates a cluster node client with provided name and options.
NewClient func(opt *Options) *Client
// The maximum number of retries before giving up. Command is retried
// on network errors and MOVED/ASK redirects.
// Default is 3 retries.
MaxRedirects int
// Enables read-only commands on slave nodes.
ReadOnly bool
// Allows routing read-only commands to the closest master or slave node.
// It automatically enables ReadOnly.
RouteByLatency bool
// Allows routing read-only commands to the random master or slave node.
// It automatically enables ReadOnly.
RouteRandomly bool
// Optional function that returns cluster slots information.
// It is useful to manually create cluster of standalone Redis servers
// and load-balance read/write operations between master and slaves.
// It can use service like ZooKeeper to maintain configuration information
// and Cluster.ReloadState to manually trigger state reloading.
ClusterSlots func(context.Context) ([]ClusterSlot, error)
Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
OnConnect func(ctx context.Context, cn *Conn) error
Username string
Password string
MaxRetries int
MinRetryBackoff time.Duration
MaxRetryBackoff time.Duration
DialTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
PoolFIFO bool
// PoolSize applies per cluster node and not for the whole cluster.
PoolSize int
MinIdleConns int
MaxConnAge time.Duration
PoolTimeout time.Duration
IdleTimeout time.Duration
IdleCheckFrequency time.Duration
TLSConfig *tls.Config
}
ClusterOptions are used to configure a cluster client and should be passed to NewClusterClient.
type ClusterSlot ¶
type ClusterSlot struct {
Start int
End int
Nodes []ClusterNode
}
type ClusterSlotsCmd ¶
type ClusterSlotsCmd struct {
// contains filtered or unexported fields
}
func NewClusterSlotsCmd ¶
func NewClusterSlotsCmd(ctx context.Context, args ...interface{}) *ClusterSlotsCmd
func NewClusterSlotsCmdResult ¶
func NewClusterSlotsCmdResult(val []ClusterSlot, err error) *ClusterSlotsCmd
NewClusterSlotsCmdResult returns a ClusterSlotsCmd initialised with val and err for testing.
func (*ClusterSlotsCmd) Result ¶
func (cmd *ClusterSlotsCmd) Result() ([]ClusterSlot, error)
func (*ClusterSlotsCmd) String ¶
func (cmd *ClusterSlotsCmd) String() string
func (*ClusterSlotsCmd) Val ¶
func (cmd *ClusterSlotsCmd) Val() []ClusterSlot
type Cmd ¶
type Cmd struct {
// contains filtered or unexported fields
}
func NewCmdResult ¶
NewCmdResult returns a Cmd initialised with val and err for testing.
type Cmdable ¶
type Cmdable interface {
Pipeline() Pipeliner
Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
TxPipeline() Pipeliner
Command(context interface{}) *CommandsInfoCmd
ClientGetName(context interface{}) *StringCmd
Echo(context interface{}, message interface{}) *StringCmd
Ping(context interface{}) *StatusCmd
Quit(context interface{}) *StatusCmd
Del(context interface{}, keys ...string) *IntCmd
Unlink(context interface{}, keys ...string) *IntCmd
Dump(context interface{}, key string) *StringCmd
Exists(context interface{}, keys ...string) *IntCmd
Expire(context interface{}, key string, expiration time.Duration) *BoolCmd
ExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
Keys(context interface{}, pattern string) *StringSliceCmd
Migrate(context interface{}, host, port, key string, db int, timeout time.Duration) *StatusCmd
Move(context interface{}, key string, db int) *BoolCmd
ObjectRefCount(context interface{}, key string) *IntCmd
ObjectEncoding(context interface{}, key string) *StringCmd
ObjectIdleTime(context interface{}, key string) *DurationCmd
Persist(context interface{}, key string) *BoolCmd
PExpire(context interface{}, key string, expiration time.Duration) *BoolCmd
PExpireAt(context interface{}, key string, tm time.Time) *BoolCmd
PTTL(context interface{}, key string) *DurationCmd
RandomKey(context interface{}) *StringCmd
Rename(context interface{}, key, newkey string) *StatusCmd
RenameNX(context interface{}, key, newkey string) *BoolCmd
Restore(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
RestoreReplace(context interface{}, key string, ttl time.Duration, value string) *StatusCmd
Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
SortStore(context interface{}, key, store string, sort *Sort) *IntCmd
SortInterfaces(context interface{}, key string, sort *Sort) *SliceCmd
Touch(context interface{}, keys ...string) *IntCmd
TTL(context interface{}, key string) *DurationCmd
Type(context interface{}, key string) *StatusCmd
Append(context interface{}, key, value string) *IntCmd
Decr(context interface{}, key string) *IntCmd
DecrBy(context interface{}, key string, decrement int64) *IntCmd
Get(ctx interface{}, key string) *StringCmd
GetRange(context interface{}, key string, start, end int64) *StringCmd
GetSet(context interface{}, key string, value interface{}) *StringCmd
GetEx(context interface{}, key string, expiration time.Duration) *StringCmd
GetDel(context interface{}, key string) *StringCmd
Incr(context interface{}, key string) *IntCmd
IncrBy(context interface{}, key string, value int64) *IntCmd
IncrByFloat(context interface{}, key string, value float64) *FloatCmd
MGet(context interface{}, keys ...string) *SliceCmd
MSet(context interface{}, values ...interface{}) *StatusCmd
MSetNX(context interface{}, values ...interface{}) *BoolCmd
Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
SetArgs(context interface{}, key string, value interface{}, a SetArgs) *StatusCmd
// TODO: rename to SetEx
SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetRange(context interface{}, key string, offset int64, value string) *IntCmd
StrLen(context interface{}, key string) *IntCmd
GetBit(context interface{}, key string, offset int64) *IntCmd
SetBit(context interface{}, key string, offset int64, value int) *IntCmd
BitCount(context interface{}, key string, bitCount *BitCount) *IntCmd
BitOpAnd(context interface{}, destKey string, keys ...string) *IntCmd
BitOpOr(context interface{}, destKey string, keys ...string) *IntCmd
BitOpXor(context interface{}, destKey string, keys ...string) *IntCmd
BitOpNot(context interface{}, destKey string, key string) *IntCmd
BitPos(context interface{}, key string, bit int64, pos ...int64) *IntCmd
BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
Scan(context interface{}, cursor uint64, match string, count int64) *ScanCmd
ScanType(context interface{}, cursor uint64, match string, count int64, keyType string) *ScanCmd
SScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
HScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
ZScan(context interface{}, key string, cursor uint64, match string, count int64) *ScanCmd
HDel(context interface{}, key string, fields ...string) *IntCmd
HExists(context interface{}, key, field string) *BoolCmd
HGet(context interface{}, key, field string) *StringCmd
HGetAll(context interface{}, key string) *StringStringMapCmd
HIncrBy(context interface{}, key, field string, incr int64) *IntCmd
HIncrByFloat(context interface{}, key, field string, incr float64) *FloatCmd
HKeys(context interface{}, key string) *StringSliceCmd
HLen(context interface{}, key string) *IntCmd
HMGet(context interface{}, key string, fields ...string) *SliceCmd
HSet(context interface{}, key string, values ...interface{}) *IntCmd
HMSet(context interface{}, key string, values ...interface{}) *BoolCmd
HSetNX(context interface{}, key, field string, value interface{}) *BoolCmd
HVals(context interface{}, key string) *StringSliceCmd
HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
BRPopLPush(context interface{}, source, destination string, timeout time.Duration) *StringCmd
LIndex(context interface{}, key string, index int64) *StringCmd
LInsert(context interface{}, key, op string, pivot, value interface{}) *IntCmd
LInsertBefore(context interface{}, key string, pivot, value interface{}) *IntCmd
LInsertAfter(context interface{}, key string, pivot, value interface{}) *IntCmd
LLen(context interface{}, key string) *IntCmd
LPop(context interface{}, key string) *StringCmd
LPopCount(context interface{}, key string, count int) *StringSliceCmd
LPos(context interface{}, key string, value string, args LPosArgs) *IntCmd
LPosCount(context interface{}, key string, value string, count int64, args LPosArgs) *IntSliceCmd
LPush(context interface{}, key string, values ...interface{}) *IntCmd
LPushX(context interface{}, key string, values ...interface{}) *IntCmd
LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
LRem(context interface{}, key string, count int64, value interface{}) *IntCmd
LSet(context interface{}, key string, index int64, value interface{}) *StatusCmd
LTrim(context interface{}, key string, start, stop int64) *StatusCmd
RPop(context interface{}, key string) *StringCmd
RPopCount(context interface{}, key string, count int) *StringSliceCmd
RPopLPush(context interface{}, source, destination string) *StringCmd
RPush(context interface{}, key string, values ...interface{}) *IntCmd
RPushX(context interface{}, key string, values ...interface{}) *IntCmd
LMove(context interface{}, source, destination, srcpos, destpos string) *StringCmd
SAdd(context interface{}, key string, members ...interface{}) *IntCmd
SCard(context interface{}, key string) *IntCmd
SDiff(context interface{}, keys ...string) *StringSliceCmd
SDiffStore(context interface{}, destination string, keys ...string) *IntCmd
SInter(context interface{}, keys ...string) *StringSliceCmd
SInterStore(context interface{}, destination string, keys ...string) *IntCmd
SIsMember(context interface{}, key string, member interface{}) *BoolCmd
SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
SMembers(context interface{}, key string) *StringSliceCmd
SMembersMap(context interface{}, key string) *StringStructMapCmd
SMove(context interface{}, source, destination string, member interface{}) *BoolCmd
SPop(context interface{}, key string) *StringCmd
SPopN(context interface{}, key string, count int64) *StringSliceCmd
SRandMember(context interface{}, key string) *StringCmd
SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
SRem(context interface{}, key string, members ...interface{}) *IntCmd
SUnion(context interface{}, keys ...string) *StringSliceCmd
SUnionStore(context interface{}, destination string, keys ...string) *IntCmd
XAdd(context interface{}, a *XAddArgs) *StringCmd
XDel(context interface{}, stream string, ids ...string) *IntCmd
XLen(context interface{}, stream string) *IntCmd
XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
XRevRange(context interface{}, stream string, start, stop string) *XMessageSliceCmd
XRevRangeN(context interface{}, stream string, start, stop string, count int64) *XMessageSliceCmd
XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
XGroupCreate(context interface{}, stream, group, start string) *StatusCmd
XGroupCreateMkStream(context interface{}, stream, group, start string) *StatusCmd
XGroupSetID(context interface{}, stream, group, start string) *StatusCmd
XGroupDestroy(context interface{}, stream, group string) *IntCmd
XGroupCreateConsumer(context interface{}, stream, group, consumer string) *IntCmd
XGroupDelConsumer(context interface{}, stream, group, consumer string) *IntCmd
XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
XAck(context interface{}, stream, group string, ids ...string) *IntCmd
XPending(context interface{}, stream, group string) *XPendingCmd
XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
// TODO: XTrim and XTrimApprox remove in v9.
XTrim(context interface{}, key string, maxLen int64) *IntCmd
XTrimApprox(context interface{}, key string, maxLen int64) *IntCmd
XTrimMaxLen(context interface{}, key string, maxLen int64) *IntCmd
XTrimMaxLenApprox(context interface{}, key string, maxLen, limit int64) *IntCmd
XTrimMinID(context interface{}, key string, minID string) *IntCmd
XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
XInfoStream(context interface{}, key string) *XInfoStreamCmd
XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
ZAdd(context interface{}, key string, members ...*Z) *IntCmd
ZAddNX(context interface{}, key string, members ...*Z) *IntCmd
ZAddXX(context interface{}, key string, members ...*Z) *IntCmd
ZAddCh(context interface{}, key string, members ...*Z) *IntCmd
ZAddNXCh(context interface{}, key string, members ...*Z) *IntCmd
ZAddXXCh(context interface{}, key string, members ...*Z) *IntCmd
ZAddArgs(context interface{}, key string, args ZAddArgs) *IntCmd
ZAddArgsIncr(context interface{}, key string, args ZAddArgs) *FloatCmd
ZIncr(context interface{}, key string, member *Z) *FloatCmd
ZIncrNX(context interface{}, key string, member *Z) *FloatCmd
ZIncrXX(context interface{}, key string, member *Z) *FloatCmd
ZCard(context interface{}, key string) *IntCmd
ZCount(context interface{}, key, min, max string) *IntCmd
ZLexCount(context interface{}, key, min, max string) *IntCmd
ZIncrBy(context interface{}, key string, increment float64, member string) *FloatCmd
ZInter(context interface{}, store *ZStore) *StringSliceCmd
ZInterWithScores(context interface{}, store *ZStore) *ZSliceCmd
ZInterStore(context interface{}, destination string, store *ZStore) *IntCmd
ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
ZPopMax(context interface{}, key string, count ...int64) *ZSliceCmd
ZPopMin(context interface{}, key string, count ...int64) *ZSliceCmd
ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
ZRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
ZRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
ZRank(context interface{}, key, member string) *IntCmd
ZRem(context interface{}, key string, members ...interface{}) *IntCmd
ZRemRangeByRank(context interface{}, key string, start, stop int64) *IntCmd
ZRemRangeByScore(context interface{}, key, min, max string) *IntCmd
ZRemRangeByLex(context interface{}, key, min, max string) *IntCmd
ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
ZRevRangeWithScores(context interface{}, key string, start, stop int64) *ZSliceCmd
ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
ZRevRangeByScoreWithScores(context interface{}, key string, opt *ZRangeBy) *ZSliceCmd
ZRevRank(context interface{}, key, member string) *IntCmd
ZScore(context interface{}, key, member string) *FloatCmd
ZUnionStore(context interface{}, dest string, store *ZStore) *IntCmd
ZUnion(context interface{}, store ZStore) *StringSliceCmd
ZUnionWithScores(context interface{}, store ZStore) *ZSliceCmd
ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
ZDiff(context interface{}, keys ...string) *StringSliceCmd
ZDiffWithScores(context interface{}, keys ...string) *ZSliceCmd
ZDiffStore(context interface{}, destination string, keys ...string) *IntCmd
PFAdd(context interface{}, key string, els ...interface{}) *IntCmd
PFCount(context interface{}, keys ...string) *IntCmd
PFMerge(context interface{}, dest string, keys ...string) *StatusCmd
BgRewriteAOF(context interface{}) *StatusCmd
BgSave(context interface{}) *StatusCmd
ClientKill(context interface{}, ipPort string) *StatusCmd
ClientKillByFilter(context interface{}, keys ...string) *IntCmd
ClientList(context interface{}) *StringCmd
ClientPause(context interface{}, dur time.Duration) *BoolCmd
ClientID(context interface{}) *IntCmd
ConfigGet(context interface{}, parameter string) *SliceCmd
ConfigResetStat(context interface{}) *StatusCmd
ConfigSet(context interface{}, parameter, value string) *StatusCmd
ConfigRewrite(context interface{}) *StatusCmd
DBSize(context interface{}) *IntCmd
FlushAll(context interface{}) *StatusCmd
FlushAllAsync(context interface{}) *StatusCmd
FlushDB(context interface{}) *StatusCmd
FlushDBAsync(context interface{}) *StatusCmd
Info(context interface{}, section ...string) *StringCmd
LastSave(context interface{}) *IntCmd
Save(context interface{}) *StatusCmd
Shutdown(context interface{}) *StatusCmd
ShutdownSave(context interface{}) *StatusCmd
ShutdownNoSave(context interface{}) *StatusCmd
SlaveOf(context interface{}, host, port string) *StatusCmd
Time(context interface{}) *TimeCmd
DebugObject(context interface{}, key string) *StringCmd
ReadOnly(context interface{}) *StatusCmd
ReadWrite(context interface{}) *StatusCmd
MemoryUsage(context interface{}, key string, samples ...int) *IntCmd
Eval(context interface{}, script string, keys []string, args ...interface{}) *Cmd
EvalSha(context interface{}, sha1 string, keys []string, args ...interface{}) *Cmd
ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
ScriptFlush(context interface{}) *StatusCmd
ScriptKill(context interface{}) *StatusCmd
ScriptLoad(context interface{}, script string) *StringCmd
Publish(context interface{}, channel string, message interface{}) *IntCmd
PubSubChannels(context interface{}, pattern string) *StringSliceCmd
PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
PubSubNumPat(context interface{}) *IntCmd
ClusterSlots(context interface{}) *ClusterSlotsCmd
ClusterNodes(context interface{}) *StringCmd
ClusterMeet(context interface{}, host, port string) *StatusCmd
ClusterForget(context interface{}, nodeID string) *StatusCmd
ClusterReplicate(context interface{}, nodeID string) *StatusCmd
ClusterResetSoft(context interface{}) *StatusCmd
ClusterResetHard(context interface{}) *StatusCmd
ClusterInfo(context interface{}) *StringCmd
ClusterKeySlot(context interface{}, key string) *IntCmd
ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
ClusterCountFailureReports(context interface{}, nodeID string) *IntCmd
ClusterCountKeysInSlot(context interface{}, slot int) *IntCmd
ClusterDelSlots(context interface{}, slots ...int) *StatusCmd
ClusterDelSlotsRange(context interface{}, min, max int) *StatusCmd
ClusterSaveConfig(context interface{}) *StatusCmd
ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
ClusterFailover(context interface{}) *StatusCmd
ClusterAddSlots(context interface{}, slots ...int) *StatusCmd
ClusterAddSlotsRange(context interface{}, min, max int) *StatusCmd
GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
GeoPos(context interface{}, key string, members ...string) *GeoPosCmd
GeoRadius(context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadiusStore(context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
GeoRadiusByMember(context interface{}, key, member string, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadiusByMemberStore(context interface{}, key, member string, query *GeoRadiusQuery) *IntCmd
GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
GeoSearchLocation(context interface{}, key string, q *GeoSearchLocationQuery) *GeoSearchLocationCmd
GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
GeoDist(context interface{}, key string, member1, member2, unit string) *FloatCmd
GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
}
type CommandInfo ¶
type CommandsInfoCmd ¶
type CommandsInfoCmd struct {
// contains filtered or unexported fields
}
func NewCommandsInfoCmd ¶
func NewCommandsInfoCmd(ctx context.Context, args ...interface{}) *CommandsInfoCmd
func NewCommandsInfoCmdResult ¶
func NewCommandsInfoCmdResult(val map[string]*CommandInfo, err error) *CommandsInfoCmd
NewCommandsInfoCmdResult returns a CommandsInfoCmd initialised with val and err for testing.
func (*CommandsInfoCmd) Result ¶
func (cmd *CommandsInfoCmd) Result() (map[string]*CommandInfo, error)
func (*CommandsInfoCmd) String ¶
func (cmd *CommandsInfoCmd) String() string
func (*CommandsInfoCmd) Val ¶
func (cmd *CommandsInfoCmd) Val() map[string]*CommandInfo
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is like Client, but its pool contains single connection.
Example ¶
conn := rdb.Conn(context.Background())
err := conn.ClientSetName(ctx, "foobar").Err()
if err != nil {
panic(err)
}
// Open other connections.
for i := 0; i < 10; i++ {
go rdb.Ping(ctx)
}
s, err := conn.ClientGetName(ctx).Result()
if err != nil {
panic(err)
}
fmt.Println(s)
Output: foobar
func (*Conn) TxPipeline ¶
TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.
type ConsistentHash ¶
type DurationCmd ¶
type DurationCmd struct {
// contains filtered or unexported fields
}
func NewDurationCmd ¶
func NewDurationCmd(ctx context.Context, precision time.Duration, args ...interface{}) *DurationCmd
func NewDurationResult ¶
func NewDurationResult(val time.Duration, err error) *DurationCmd
NewDurationResult returns a DurationCmd initialised with val and err for testing.
func (*DurationCmd) String ¶
func (cmd *DurationCmd) String() string
func (*DurationCmd) Val ¶
func (cmd *DurationCmd) Val() time.Duration
type Error ¶
type Error interface {
error
// RedisError is a no-op function but
// serves to distinguish types that are Redis
// errors from ordinary errors: a type is a
// Redis error if it has a RedisError method.
RedisError()
}
type FailoverOptions ¶
type FailoverOptions struct {
// The master name.
MasterName string
// A seed list of host:port addresses of sentinel nodes.
SentinelAddrs []string
// Sentinel password from "requirepass <password>" (if enabled) in Sentinel configuration
SentinelPassword string
// Allows routing read-only commands to the closest master or slave node.
// This option only works with NewFailoverClusterClient.
RouteByLatency bool
// Allows routing read-only commands to the random master or slave node.
// This option only works with NewFailoverClusterClient.
RouteRandomly bool
// Route all commands to slave read-only nodes.
SlaveOnly bool
// Use slaves disconnected with master when cannot get connected slaves
// Now, this option only works in RandomSlaveAddr function.
UseDisconnectedSlaves bool
Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
OnConnect func(ctx context.Context, cn *Conn) error
Username string
Password string
DB int
MaxRetries int
MinRetryBackoff time.Duration
MaxRetryBackoff time.Duration
DialTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
PoolFIFO bool
PoolSize int
MinIdleConns int
MaxConnAge time.Duration
PoolTimeout time.Duration
IdleTimeout time.Duration
IdleCheckFrequency time.Duration
TLSConfig *tls.Config
}
FailoverOptions are used to configure a failover client and should be passed to NewFailoverClient.
type FloatCmd ¶
type FloatCmd struct {
// contains filtered or unexported fields
}
func NewFloatCmd ¶
func NewFloatResult ¶
NewFloatResult returns a FloatCmd initialised with val and err for testing.
type FloatSliceCmd ¶
type FloatSliceCmd struct {
// contains filtered or unexported fields
}
func NewFloatSliceCmd ¶
func NewFloatSliceCmd(ctx context.Context, args ...interface{}) *FloatSliceCmd
func (*FloatSliceCmd) Result ¶
func (cmd *FloatSliceCmd) Result() ([]float64, error)
func (*FloatSliceCmd) String ¶
func (cmd *FloatSliceCmd) String() string
func (*FloatSliceCmd) Val ¶
func (cmd *FloatSliceCmd) Val() []float64
type GeoLocation ¶
GeoLocation is used with GeoAdd to add geospatial location.
type GeoLocationCmd ¶
type GeoLocationCmd struct {
// contains filtered or unexported fields
}
func NewGeoLocationCmd ¶
func NewGeoLocationCmd(ctx context.Context, q *GeoRadiusQuery, args ...interface{}) *GeoLocationCmd
func NewGeoLocationCmdResult ¶
func NewGeoLocationCmdResult(val []GeoLocation, err error) *GeoLocationCmd
NewGeoLocationCmdResult returns a GeoLocationCmd initialised with val and err for testing.
func (*GeoLocationCmd) Result ¶
func (cmd *GeoLocationCmd) Result() ([]GeoLocation, error)
func (*GeoLocationCmd) String ¶
func (cmd *GeoLocationCmd) String() string
func (*GeoLocationCmd) Val ¶
func (cmd *GeoLocationCmd) Val() []GeoLocation
type GeoPosCmd ¶
type GeoPosCmd struct {
// contains filtered or unexported fields
}
func NewGeoPosCmd ¶
func NewGeoPosCmdResult ¶
NewGeoPosCmdResult returns a GeoPosCmd initialised with val and err for testing.
type GeoRadiusQuery ¶
type GeoRadiusQuery struct {
Radius float64
// Can be m, km, ft, or mi. Default is km.
Unit string
WithCoord bool
WithDist bool
WithGeoHash bool
Count int
// Can be ASC or DESC. Default is no sort order.
Sort string
Store string
StoreDist string
}
GeoRadiusQuery is used with GeoRadius to query geospatial index.
type GeoSearchLocationCmd ¶
type GeoSearchLocationCmd struct {
// contains filtered or unexported fields
}
func NewGeoSearchLocationCmd ¶
func NewGeoSearchLocationCmd( ctx context.Context, opt *GeoSearchLocationQuery, args ...interface{}, ) *GeoSearchLocationCmd
func (*GeoSearchLocationCmd) Result ¶
func (cmd *GeoSearchLocationCmd) Result() ([]GeoLocation, error)
func (*GeoSearchLocationCmd) String ¶
func (cmd *GeoSearchLocationCmd) String() string
func (*GeoSearchLocationCmd) Val ¶
func (cmd *GeoSearchLocationCmd) Val() []GeoLocation
type GeoSearchLocationQuery ¶
type GeoSearchLocationQuery struct {
GeoSearchQuery
WithCoord bool
WithDist bool
WithHash bool
}
type GeoSearchQuery ¶
type GeoSearchQuery struct {
Member string
// Latitude and Longitude when using FromLonLat option.
Longitude float64
Latitude float64
// Distance and unit when using ByRadius option.
// Can use m, km, ft, or mi. Default is km.
Radius float64
RadiusUnit string
// Height, width and unit when using ByBox option.
// Can be m, km, ft, or mi. Default is km.
BoxWidth float64
BoxHeight float64
BoxUnit string
// Can be ASC or DESC. Default is no sort order.
Sort string
Count int
CountAny bool
}
GeoSearchQuery is used for GEOSearch/GEOSearchStore command query.
type GeoSearchStoreQuery ¶
type GeoSearchStoreQuery struct {
GeoSearchQuery
// When using the StoreDist option, the command stores the items in a
// sorted set populated with their distance from the center of the circle or box,
// as a floating-point number, in the same unit specified for that shape.
StoreDist bool
}
type IntCmd ¶
type IntCmd struct {
// contains filtered or unexported fields
}
func NewIntResult ¶
NewIntResult returns an IntCmd initialised with val and err for testing.
type IntSliceCmd ¶
type IntSliceCmd struct {
// contains filtered or unexported fields
}
func NewIntSliceCmd ¶
func NewIntSliceCmd(ctx context.Context, args ...interface{}) *IntSliceCmd
func (*IntSliceCmd) Result ¶
func (cmd *IntSliceCmd) Result() ([]int64, error)
func (*IntSliceCmd) String ¶
func (cmd *IntSliceCmd) String() string
func (*IntSliceCmd) Val ¶
func (cmd *IntSliceCmd) Val() []int64
type Limiter ¶
type Limiter interface {
// Allow returns nil if operation is allowed or an error otherwise.
// If operation is allowed client must ReportResult of the operation
// whether it is a success or a failure.
Allow() error
// ReportResult reports the result of the previously allowed operation.
// nil indicates a success, non-nil error usually indicates a failure.
ReportResult(result error)
}
Limiter is the interface of a rate limiter or a circuit breaker.
type Options ¶
type Options struct {
// The network type, either tcp or unix.
// Default is tcp.
Network string
// host:port address.
Addr string
// Dialer creates new network connection and has priority over
// Network and Addr options.
Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
// Hook that is called when new connection is established.
OnConnect func(ctx context.Context, cn *Conn) error
// Use the specified Username to authenticate the current connection
// with one of the connections defined in the ACL list when connecting
// to a Redis 6.0 instance, or greater, that is using the Redis ACL system.
Username string
// Optional password. Must match the password specified in the
// requirepass server configuration option (if connecting to a Redis 5.0 instance, or lower),
// or the User Password when connecting to a Redis 6.0 instance, or greater,
// that is using the Redis ACL system.
Password string
// Database to be selected after connecting to the server.
DB int
// Maximum number of retries before giving up.
// Default is 3 retries; -1 (not 0) disables retries.
MaxRetries int
// Minimum backoff between each retry.
// Default is 8 milliseconds; -1 disables backoff.
MinRetryBackoff time.Duration
// Maximum backoff between each retry.
// Default is 512 milliseconds; -1 disables backoff.
MaxRetryBackoff time.Duration
// Dial timeout for establishing new connections.
// Default is 5 seconds.
DialTimeout time.Duration
// Timeout for socket reads. If reached, commands will fail
// with a timeout instead of blocking. Use value -1 for no timeout and 0 for default.
// Default is 3 seconds.
ReadTimeout time.Duration
// Timeout for socket writes. If reached, commands will fail
// with a timeout instead of blocking.
// Default is ReadTimeout.
WriteTimeout time.Duration
// Type of connection pool.
// true for FIFO pool, false for LIFO pool.
// Note that fifo has higher overhead compared to lifo.
PoolFIFO bool
// Maximum number of socket connections.
// Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.
PoolSize int
// Minimum number of idle connections which is useful when establishing
// new connection is slow.
MinIdleConns int
// Connection age at which client retires (closes) the connection.
// Default is to not close aged connections.
MaxConnAge time.Duration
// Amount of time client waits for connection if all connections
// are busy before returning an error.
// Default is ReadTimeout + 1 second.
PoolTimeout time.Duration
// Amount of time after which client closes idle connections.
// Should be less than server's timeout.
// Default is 5 minutes. -1 disables idle timeout check.
IdleTimeout time.Duration
// Frequency of idle checks made by idle connections reaper.
// Default is 1 minute. -1 disables idle connections reaper,
// but idle connections are still discarded by the client
// if IdleTimeout is set.
IdleCheckFrequency time.Duration
// TLS Config to use. When set TLS will be negotiated.
TLSConfig *tls.Config
// Limiter interface used to implemented circuit breaker or rate limiter.
Limiter Limiter
// contains filtered or unexported fields
}
Options keeps the settings to setup redis connection.
func ParseURL ¶
ParseURL parses an URL into Options that can be used to connect to Redis. Scheme is required. There are two connection types: by tcp socket and by unix socket. Tcp connection:
redis://<user>:<password>@<host>:<port>/<db_number>
Unix connection:
unix://<user>:<password>@</path/to/redis.sock>?db=<db_number>
Example ¶
opt, err := redis.ParseURL("redis://:qwerty@localhost:6379/1")
if err != nil {
panic(err)
}
fmt.Println("addr is", opt.Addr)
fmt.Println("db is", opt.DB)
fmt.Println("password is", opt.Password)
// Create client as usually.
_ = redis.NewClient(opt)
Output: addr is localhost:6379 db is 1 password is qwerty
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline implements pipelining as described in http://redis.io/topics/pipelining. It's safe for concurrent use by multiple goroutines.
Example (Instrumentation) ¶
rdb := redis.NewClient(&redis.Options{
Addr: ":6379",
})
rdb.AddHook(redisHook{})
rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {
pipe.Ping(ctx)
pipe.Ping(ctx)
return nil
})
Output: pipeline starting processing: [ping: ping: ] pipeline finished processing: [ping: PONG ping: PONG]
func (Pipeline) AuthACL ¶
AuthACL Perform an AUTH command, using the given user and pass. Should be used to authenticate the current connection with one of the connections defined in the ACL list when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system.
func (Pipeline) BLPop ¶
func (c Pipeline) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (Pipeline) BRPop ¶
func (c Pipeline) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (Pipeline) BRPopLPush ¶
func (Pipeline) BZPopMax ¶
func (c Pipeline) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.
func (Pipeline) BZPopMin ¶
func (c Pipeline) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.
func (Pipeline) BgRewriteAOF ¶
func (c Pipeline) BgRewriteAOF(context interface{}) *StatusCmd
func (Pipeline) BitField ¶
func (c Pipeline) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
func (Pipeline) ClientGetName ¶
func (c Pipeline) ClientGetName(context interface{}) *StringCmd
ClientGetName returns the name of the connection.
func (Pipeline) ClientKill ¶
func (Pipeline) ClientKillByFilter ¶
ClientKillByFilter is new style syntax, while the ClientKill is old
CLIENT KILL <option> [value] ... <option> [value]
func (Pipeline) ClientList ¶
func (c Pipeline) ClientList(context interface{}) *StringCmd
func (Pipeline) ClientPause ¶
func (Pipeline) ClientSetName ¶
ClientSetName assigns a name to the connection.
func (Pipeline) ClientUnblock ¶
func (Pipeline) ClientUnblockWithError ¶
func (Pipeline) ClusterAddSlots ¶
func (Pipeline) ClusterAddSlotsRange ¶
func (Pipeline) ClusterCountFailureReports ¶
func (Pipeline) ClusterCountKeysInSlot ¶
func (Pipeline) ClusterDelSlots ¶
func (Pipeline) ClusterDelSlotsRange ¶
func (Pipeline) ClusterFailover ¶
func (c Pipeline) ClusterFailover(context interface{}) *StatusCmd
func (Pipeline) ClusterForget ¶
func (Pipeline) ClusterGetKeysInSlot ¶
func (c Pipeline) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
func (Pipeline) ClusterInfo ¶
func (c Pipeline) ClusterInfo(context interface{}) *StringCmd
func (Pipeline) ClusterKeySlot ¶
func (Pipeline) ClusterMeet ¶
func (Pipeline) ClusterNodes ¶
func (c Pipeline) ClusterNodes(context interface{}) *StringCmd
func (Pipeline) ClusterReplicate ¶
func (Pipeline) ClusterResetHard ¶
func (c Pipeline) ClusterResetHard(context interface{}) *StatusCmd
func (Pipeline) ClusterResetSoft ¶
func (c Pipeline) ClusterResetSoft(context interface{}) *StatusCmd
func (Pipeline) ClusterSaveConfig ¶
func (c Pipeline) ClusterSaveConfig(context interface{}) *StatusCmd
func (Pipeline) ClusterSlaves ¶
func (c Pipeline) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
func (Pipeline) ClusterSlots ¶
func (c Pipeline) ClusterSlots(context interface{}) *ClusterSlotsCmd
func (Pipeline) Command ¶
func (c Pipeline) Command(context interface{}) *CommandsInfoCmd
func (Pipeline) ConfigResetStat ¶
func (c Pipeline) ConfigResetStat(context interface{}) *StatusCmd
func (Pipeline) ConfigRewrite ¶
func (c Pipeline) ConfigRewrite(context interface{}) *StatusCmd
func (Pipeline) DebugObject ¶
func (*Pipeline) Exec ¶
Exec executes all previously queued commands using one client-server roundtrip.
Exec always returns list of commands and error of the first failed command if any.
func (Pipeline) FlushAllAsync ¶
func (c Pipeline) FlushAllAsync(context interface{}) *StatusCmd
func (Pipeline) FlushDBAsync ¶
func (c Pipeline) FlushDBAsync(context interface{}) *StatusCmd
func (Pipeline) GeoAdd ¶
func (c Pipeline) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
func (Pipeline) GeoHash ¶
func (c Pipeline) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
func (Pipeline) GeoRadius ¶
func (c Pipeline) GeoRadius(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Pipeline) GeoRadiusByMember ¶
func (c Pipeline) GeoRadiusByMember(
context interface{}, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.
func (Pipeline) GeoRadiusByMemberStore ¶
func (c Pipeline) GeoRadiusByMemberStore(
context interface{}, key, member string, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Pipeline) GeoRadiusStore ¶
func (c Pipeline) GeoRadiusStore(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Pipeline) GeoSearch ¶
func (c Pipeline) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
func (Pipeline) GeoSearchLocation ¶
func (c Pipeline) GeoSearchLocation(
context interface{}, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd
func (Pipeline) GeoSearchStore ¶
func (c Pipeline) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
func (Pipeline) Get ¶
Get Redis `GET key` command. It returns redis.Nil error when key does not exist.
func (Pipeline) GetEx ¶
GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.
func (Pipeline) HGetAll ¶
func (c Pipeline) HGetAll(context interface{}, key string) *StringStringMapCmd
func (Pipeline) HIncrByFloat ¶
func (Pipeline) HKeys ¶
func (c Pipeline) HKeys(context interface{}, key string) *StringSliceCmd
func (Pipeline) HMGet ¶
HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.
func (Pipeline) HRandField ¶
func (c Pipeline) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
HRandField redis-server version >= 6.2.0.
func (Pipeline) HSet ¶
HSet accepts values in following formats:
- HSet("myhash", "key1", "value1", "key2", "value2")
- HSet("myhash", []string{"key1", "value1", "key2", "value2"})
- HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it requires Redis v4 for multiple field/value pairs support.
func (Pipeline) HVals ¶
func (c Pipeline) HVals(context interface{}, key string) *StringSliceCmd
func (Pipeline) IncrByFloat ¶
func (Pipeline) Keys ¶
func (c Pipeline) Keys(context interface{}, pattern string) *StringSliceCmd
func (Pipeline) LInsertAfter ¶
func (Pipeline) LInsertBefore ¶
func (Pipeline) LPopCount ¶
func (c Pipeline) LPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Pipeline) LPosCount ¶
func (c Pipeline) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
func (Pipeline) LRange ¶
func (c Pipeline) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Pipeline) MSet ¶
func (c Pipeline) MSet(context interface{}, values ...interface{}) *StatusCmd
MSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Pipeline) MSetNX ¶
func (c Pipeline) MSetNX(context interface{}, values ...interface{}) *BoolCmd
MSetNX is like SetNX but accepts multiple values:
- MSetNX("key1", "value1", "key2", "value2")
- MSetNX([]string{"key1", "value1", "key2", "value2"})
- MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Pipeline) MemoryUsage ¶
func (Pipeline) ObjectEncoding ¶
func (Pipeline) ObjectIdleTime ¶
func (c Pipeline) ObjectIdleTime(context interface{}, key string) *DurationCmd
func (Pipeline) ObjectRefCount ¶
func (Pipeline) PTTL ¶
func (c Pipeline) PTTL(context interface{}, key string) *DurationCmd
func (Pipeline) PubSubChannels ¶
func (c Pipeline) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
func (Pipeline) PubSubNumPat ¶
func (c Pipeline) PubSubNumPat(context interface{}) *IntCmd
func (Pipeline) PubSubNumSub ¶
func (c Pipeline) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
func (Pipeline) RPopCount ¶
func (c Pipeline) RPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Pipeline) RestoreReplace ¶
func (Pipeline) SDiff ¶
func (c Pipeline) SDiff(context interface{}, keys ...string) *StringSliceCmd
func (Pipeline) SDiffStore ¶
func (Pipeline) SInter ¶
func (c Pipeline) SInter(context interface{}, keys ...string) *StringSliceCmd
func (Pipeline) SInterStore ¶
func (Pipeline) SMIsMember ¶
func (c Pipeline) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
SMIsMember Redis `SMISMEMBER key member [member ...]` command.
func (Pipeline) SMembers ¶
func (c Pipeline) SMembers(context interface{}, key string) *StringSliceCmd
SMembers Redis `SMEMBERS key` command output as a slice.
func (Pipeline) SMembersMap ¶
func (c Pipeline) SMembersMap(context interface{}, key string) *StringStructMapCmd
SMembersMap Redis `SMEMBERS key` command output as a map.
func (Pipeline) SPopN ¶
func (c Pipeline) SPopN(context interface{}, key string, count int64) *StringSliceCmd
SPopN Redis `SPOP key count` command.
func (Pipeline) SRandMember ¶
SRandMember Redis `SRANDMEMBER key` command.
func (Pipeline) SRandMemberN ¶
func (c Pipeline) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
SRandMemberN Redis `SRANDMEMBER key count` command.
func (Pipeline) SUnion ¶
func (c Pipeline) SUnion(context interface{}, keys ...string) *StringSliceCmd
func (Pipeline) SUnionStore ¶
func (Pipeline) ScriptExists ¶
func (c Pipeline) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
func (Pipeline) ScriptFlush ¶
func (c Pipeline) ScriptFlush(context interface{}) *StatusCmd
func (Pipeline) ScriptKill ¶
func (c Pipeline) ScriptKill(context interface{}) *StatusCmd
func (Pipeline) ScriptLoad ¶
func (Pipeline) Set ¶
func (c Pipeline) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
Set Redis `SET key value [expiration]` command. Use expiration for `SETEX`-like behavior.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Pipeline) SetArgs ¶
SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.
func (Pipeline) SetEX ¶
func (c Pipeline) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
SetEX Redis `SETEX key expiration value` command.
func (Pipeline) SetNX ¶
func (c Pipeline) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetNX Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Pipeline) SetXX ¶
func (c Pipeline) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetXX Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Pipeline) ShutdownNoSave ¶
func (c Pipeline) ShutdownNoSave(context interface{}) *StatusCmd
func (Pipeline) ShutdownSave ¶
func (c Pipeline) ShutdownSave(context interface{}) *StatusCmd
func (Pipeline) SlowLogGet ¶
func (c Pipeline) SlowLogGet(context interface{}, num int64) *SlowLogCmd
func (Pipeline) Sort ¶
func (c Pipeline) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
func (Pipeline) SortInterfaces ¶
func (Pipeline) TTL ¶
func (c Pipeline) TTL(context interface{}, key string) *DurationCmd
func (*Pipeline) TxPipeline ¶
func (*Pipeline) TxPipelined ¶
func (Pipeline) XAdd ¶
XAdd a.Limit has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046
func (Pipeline) XAutoClaim ¶
func (c Pipeline) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
func (Pipeline) XAutoClaimJustID ¶
func (c Pipeline) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
func (Pipeline) XClaim ¶
func (c Pipeline) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
func (Pipeline) XClaimJustID ¶
func (c Pipeline) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
func (Pipeline) XGroupCreate ¶
func (Pipeline) XGroupCreateConsumer ¶
func (Pipeline) XGroupCreateMkStream ¶
func (Pipeline) XGroupDelConsumer ¶
func (Pipeline) XGroupDestroy ¶
func (Pipeline) XGroupSetID ¶
func (Pipeline) XInfoConsumers ¶
func (c Pipeline) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
func (Pipeline) XInfoGroups ¶
func (c Pipeline) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
func (Pipeline) XInfoStream ¶
func (c Pipeline) XInfoStream(context interface{}, key string) *XInfoStreamCmd
func (Pipeline) XInfoStreamFull ¶
func (c Pipeline) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
XInfoStreamFull XINFO STREAM FULL [COUNT count] redis-server >= 6.0.
func (Pipeline) XPending ¶
func (c Pipeline) XPending(context interface{}, stream, group string) *XPendingCmd
func (Pipeline) XPendingExt ¶
func (c Pipeline) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
func (Pipeline) XRange ¶
func (c Pipeline) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Pipeline) XRangeN ¶
func (c Pipeline) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Pipeline) XRead ¶
func (c Pipeline) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
func (Pipeline) XReadGroup ¶
func (c Pipeline) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
func (Pipeline) XReadStreams ¶
func (c Pipeline) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
func (Pipeline) XRevRange ¶
func (c Pipeline) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Pipeline) XRevRangeN ¶
func (c Pipeline) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Pipeline) XTrimApprox
deprecated
func (Pipeline) XTrimMaxLen ¶
XTrimMaxLen No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MAXLEN maxLen
func (Pipeline) XTrimMaxLenApprox ¶
XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit
func (Pipeline) XTrimMinID ¶
XTrimMinID No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MINID minID
func (Pipeline) XTrimMinIDApprox ¶
func (c Pipeline) XTrimMinIDApprox(context interface{}, key string, minID string, limit int64) *IntCmd
XTrimMinIDApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MINID ~ minID LIMIT limit
func (Pipeline) ZAddArgsIncr ¶
func (Pipeline) ZAddCh ¶
ZAddCh Redis `ZADD key CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
Ch: true,
Members: []Z,
})
remove in v9.
func (Pipeline) ZAddNXCh ¶
ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
NX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Pipeline) ZAddXXCh ¶
ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
XX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Pipeline) ZDiff ¶
func (c Pipeline) ZDiff(context interface{}, keys ...string) *StringSliceCmd
ZDiff redis-server version >= 6.2.0.
func (Pipeline) ZDiffStore ¶
ZDiffStore redis-server version >=6.2.0.
func (Pipeline) ZDiffWithScores ¶
ZDiffWithScores redis-server version >= 6.2.0.
func (Pipeline) ZIncr ¶
ZIncr Redis `ZADD key INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
Members: []Z,
})
remove in v9.
func (Pipeline) ZIncrNX ¶
ZIncrNX Redis `ZADD key NX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
NX: true,
Members: []Z,
})
remove in v9.
func (Pipeline) ZIncrXX ¶
ZIncrXX Redis `ZADD key XX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
XX: true,
Members: []Z,
})
remove in v9.
func (Pipeline) ZInter ¶
func (c Pipeline) ZInter(context interface{}, store *ZStore) *StringSliceCmd
func (Pipeline) ZInterStore ¶
func (Pipeline) ZInterWithScores ¶
func (Pipeline) ZMScore ¶
func (c Pipeline) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
func (Pipeline) ZRandMember ¶
func (c Pipeline) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
ZRandMember redis-server version >= 6.2.0.
func (Pipeline) ZRange ¶
func (c Pipeline) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Pipeline) ZRangeArgs ¶
func (c Pipeline) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
func (Pipeline) ZRangeArgsWithScores ¶
func (c Pipeline) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
func (Pipeline) ZRangeByLex ¶
func (c Pipeline) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRangeByScore ¶
func (c Pipeline) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRangeByScoreWithScores ¶
func (Pipeline) ZRangeStore ¶
func (c Pipeline) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
func (Pipeline) ZRangeWithScores ¶
func (Pipeline) ZRemRangeByLex ¶
func (Pipeline) ZRemRangeByRank ¶
func (Pipeline) ZRemRangeByScore ¶
func (Pipeline) ZRevRange ¶
func (c Pipeline) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Pipeline) ZRevRangeByLex ¶
func (c Pipeline) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRevRangeByScore ¶
func (c Pipeline) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRevRangeByScoreWithScores ¶
func (Pipeline) ZRevRangeWithScores ¶
func (Pipeline) ZUnion ¶
func (c Pipeline) ZUnion(context interface{}, store ZStore) *StringSliceCmd
func (Pipeline) ZUnionStore ¶
func (Pipeline) ZUnionWithScores ¶
type Pipeliner ¶
type Pipeliner interface {
StatefulCmdable
Do(ctx context.Context, args ...interface{}) *Cmd
Process(ctx context.Context, cmd Cmder) error
Close() error
Discard() error
Exec(ctx context.Context) ([]Cmder, error)
}
Pipeliner is an mechanism to realise Redis Pipeline technique.
Pipelining is a technique to extremely speed up processing by packing operations to batches, send them at once to Redis and read a replies in a singe step. See https://redis.io/topics/pipelining
Pay attention, that Pipeline is not a transaction, so you can get unexpected results in case of big pipelines and small read/write timeouts. Redis client has retransmission logic in case of timeouts, pipeline can be retransmitted and commands can be executed more then once. To avoid this: it is good idea to use reasonable bigger read/write timeouts depends of your batch size and/or use TxPipeline.
type Pong ¶
type Pong struct {
Payload string
}
Pong received as result of a PING command issued by another client.
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub implements Pub/Sub commands as described in http://redis.io/topics/pubsub. Message receiving is NOT safe for concurrent use by multiple goroutines.
PubSub automatically reconnects to Redis Server and resubscribes to the channels in case of network errors.
Example ¶
pubsub := rdb.Subscribe(ctx, "mychannel1")
// Wait for confirmation that subscription is created before publishing anything.
_, err := pubsub.Receive(ctx)
if err != nil {
panic(err)
}
// Go channel which receives messages.
ch := pubsub.Channel()
// Publish a message.
err = rdb.Publish(ctx, "mychannel1", "hello").Err()
if err != nil {
panic(err)
}
time.AfterFunc(time.Second, func() {
// When pubsub is closed channel is closed too.
_ = pubsub.Close()
})
// Consume messages.
for msg := range ch {
fmt.Println(msg.Channel, msg.Payload)
}
Output: mychannel1 hello
func (*PubSub) Channel ¶
func (c *PubSub) Channel(opts ...ChannelOption) <-chan *Message
Channel returns a Go channel for concurrently receiving messages. The channel is closed together with the PubSub. If the Go channel is blocked full for 30 seconds the message is dropped. Receive* APIs can not be used after channel is created.
go-redis periodically sends ping messages to test connection health and re-subscribes if ping can not not received for 30 seconds.
func (*PubSub) ChannelSize
deprecated
func (*PubSub) ChannelWithSubscriptions ¶
ChannelWithSubscriptions is like Channel, but message type can be either *Subscription or *Message. Subscription messages can be used to detect reconnections.
ChannelWithSubscriptions can not be used together with Channel or ChannelSize.
func (*PubSub) PSubscribe ¶
PSubscribe the client to the given patterns. It returns empty subscription if there are no patterns.
func (*PubSub) PUnsubscribe ¶
PUnsubscribe the client from the given patterns, or from all of them if none is given.
func (*PubSub) Receive ¶
Receive returns a message as a Subscription, Message, Pong or error. See PubSub example for details. This is low-level API and in most cases Channel should be used instead.
Example ¶
pubsub := rdb.Subscribe(ctx, "mychannel2")
defer pubsub.Close()
for i := 0; i < 2; i++ {
// ReceiveTimeout is a low level API. Use ReceiveMessage instead.
msgi, err := pubsub.ReceiveTimeout(ctx, time.Second)
if err != nil {
break
}
switch msg := msgi.(type) {
case *redis.Subscription:
fmt.Println("subscribed to", msg.Channel)
_, err := rdb.Publish(ctx, "mychannel2", "hello").Result()
if err != nil {
panic(err)
}
case *redis.Message:
fmt.Println("received", msg.Payload, "from", msg.Channel)
default:
panic("unreached")
}
}
// sent message to 1 rdb
// received hello from mychannel2
func (*PubSub) ReceiveMessage ¶
ReceiveMessage returns a Message or error ignoring Subscription and Pong messages. This is low-level API and in most cases Channel should be used instead.
func (*PubSub) ReceiveTimeout ¶
ReceiveTimeout acts like Receive but returns an error if message is not received in time. This is low-level API and in most cases Channel should be used instead.
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring is a Redis client that uses consistent hashing to distribute keys across multiple Redis servers (shards). It's safe for concurrent use by multiple goroutines.
Ring monitors the state of each shard and removes dead shards from the ring. When a shard comes online it is added back to the ring. This gives you maximum availability and partition tolerance, but no consistency between different shards or even clients. Each client uses shards that are available to the client and does not do any coordination when shard state is changed.
Ring should be used when you need multiple Redis servers for caching and can tolerate losing data when one of the servers dies. Otherwise you should use Redis Cluster.
func NewRing ¶
func NewRing(opt *RingOptions) *Ring
Example ¶
rdb := redis.NewRing(&redis.RingOptions{
Addrs: map[string]string{
"shard1": ":7000",
"shard2": ":7001",
"shard3": ":7002",
},
})
rdb.Ping(ctx)
func (Ring) BLPop ¶
func (c Ring) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (Ring) BRPop ¶
func (c Ring) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (Ring) BRPopLPush ¶
func (Ring) BZPopMax ¶
func (c Ring) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.
func (Ring) BZPopMin ¶
func (c Ring) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.
func (Ring) BgRewriteAOF ¶
func (c Ring) BgRewriteAOF(context interface{}) *StatusCmd
func (Ring) BitField ¶
func (c Ring) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
func (Ring) ClientGetName ¶
func (c Ring) ClientGetName(context interface{}) *StringCmd
ClientGetName returns the name of the connection.
func (Ring) ClientKill ¶
func (Ring) ClientKillByFilter ¶
ClientKillByFilter is new style syntax, while the ClientKill is old
CLIENT KILL <option> [value] ... <option> [value]
func (Ring) ClientList ¶
func (c Ring) ClientList(context interface{}) *StringCmd
func (Ring) ClientPause ¶
func (Ring) ClientUnblock ¶
func (Ring) ClientUnblockWithError ¶
func (*Ring) Close ¶
Close closes the ring client, releasing any open resources.
It is rare to Close a Ring, as the Ring is meant to be long-lived and shared between many goroutines.
func (Ring) ClusterAddSlots ¶
func (Ring) ClusterAddSlotsRange ¶
func (Ring) ClusterCountFailureReports ¶
func (Ring) ClusterCountKeysInSlot ¶
func (Ring) ClusterDelSlots ¶
func (Ring) ClusterDelSlotsRange ¶
func (Ring) ClusterFailover ¶
func (c Ring) ClusterFailover(context interface{}) *StatusCmd
func (Ring) ClusterForget ¶
func (Ring) ClusterGetKeysInSlot ¶
func (c Ring) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
func (Ring) ClusterInfo ¶
func (c Ring) ClusterInfo(context interface{}) *StringCmd
func (Ring) ClusterKeySlot ¶
func (Ring) ClusterMeet ¶
func (Ring) ClusterNodes ¶
func (c Ring) ClusterNodes(context interface{}) *StringCmd
func (Ring) ClusterReplicate ¶
func (Ring) ClusterResetHard ¶
func (c Ring) ClusterResetHard(context interface{}) *StatusCmd
func (Ring) ClusterResetSoft ¶
func (c Ring) ClusterResetSoft(context interface{}) *StatusCmd
func (Ring) ClusterSaveConfig ¶
func (c Ring) ClusterSaveConfig(context interface{}) *StatusCmd
func (Ring) ClusterSlaves ¶
func (c Ring) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
func (Ring) ClusterSlots ¶
func (c Ring) ClusterSlots(context interface{}) *ClusterSlotsCmd
func (Ring) Command ¶
func (c Ring) Command(context interface{}) *CommandsInfoCmd
func (Ring) ConfigResetStat ¶
func (c Ring) ConfigResetStat(context interface{}) *StatusCmd
func (Ring) ConfigRewrite ¶
func (c Ring) ConfigRewrite(context interface{}) *StatusCmd
func (Ring) DebugObject ¶
func (Ring) FlushAllAsync ¶
func (c Ring) FlushAllAsync(context interface{}) *StatusCmd
func (Ring) FlushDBAsync ¶
func (c Ring) FlushDBAsync(context interface{}) *StatusCmd
func (*Ring) ForEachShard ¶
func (c *Ring) ForEachShard( ctx context.Context, fn func(ctx context.Context, client *Client) error, ) error
ForEachShard concurrently calls the fn on each live shard in the ring. It returns the first error if any.
func (Ring) GeoAdd ¶
func (c Ring) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
func (Ring) GeoHash ¶
func (c Ring) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
func (Ring) GeoRadius ¶
func (c Ring) GeoRadius(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Ring) GeoRadiusByMember ¶
func (c Ring) GeoRadiusByMember(
context interface{}, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.
func (Ring) GeoRadiusByMemberStore ¶
func (c Ring) GeoRadiusByMemberStore(
context interface{}, key, member string, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Ring) GeoRadiusStore ¶
func (c Ring) GeoRadiusStore(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Ring) GeoSearch ¶
func (c Ring) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
func (Ring) GeoSearchLocation ¶
func (c Ring) GeoSearchLocation(
context interface{}, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd
func (Ring) GeoSearchStore ¶
func (c Ring) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
func (Ring) GetEx ¶
GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.
func (Ring) HGetAll ¶
func (c Ring) HGetAll(context interface{}, key string) *StringStringMapCmd
func (Ring) HIncrByFloat ¶
func (Ring) HKeys ¶
func (c Ring) HKeys(context interface{}, key string) *StringSliceCmd
func (Ring) HMGet ¶
HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.
func (Ring) HRandField ¶
func (c Ring) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
HRandField redis-server version >= 6.2.0.
func (Ring) HSet ¶
HSet accepts values in following formats:
- HSet("myhash", "key1", "value1", "key2", "value2")
- HSet("myhash", []string{"key1", "value1", "key2", "value2"})
- HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it requires Redis v4 for multiple field/value pairs support.
func (Ring) HVals ¶
func (c Ring) HVals(context interface{}, key string) *StringSliceCmd
func (Ring) IncrByFloat ¶
func (Ring) Keys ¶
func (c Ring) Keys(context interface{}, pattern string) *StringSliceCmd
func (Ring) LInsertAfter ¶
func (Ring) LInsertBefore ¶
func (Ring) LPopCount ¶
func (c Ring) LPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Ring) LPosCount ¶
func (c Ring) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
func (Ring) LRange ¶
func (c Ring) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Ring) MSet ¶
func (c Ring) MSet(context interface{}, values ...interface{}) *StatusCmd
MSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Ring) MSetNX ¶
func (c Ring) MSetNX(context interface{}, values ...interface{}) *BoolCmd
MSetNX is like SetNX but accepts multiple values:
- MSetNX("key1", "value1", "key2", "value2")
- MSetNX([]string{"key1", "value1", "key2", "value2"})
- MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Ring) MemoryUsage ¶
func (Ring) ObjectEncoding ¶
func (Ring) ObjectIdleTime ¶
func (c Ring) ObjectIdleTime(context interface{}, key string) *DurationCmd
func (Ring) ObjectRefCount ¶
func (*Ring) Options ¶
func (c *Ring) Options() *RingOptions
Options returns read-only Options that were used to create the client.
func (*Ring) PSubscribe ¶
PSubscribe subscribes the client to the given patterns.
func (Ring) PTTL ¶
func (c Ring) PTTL(context interface{}, key string) *DurationCmd
func (Ring) PubSubChannels ¶
func (c Ring) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
func (Ring) PubSubNumPat ¶
func (c Ring) PubSubNumPat(context interface{}) *IntCmd
func (Ring) PubSubNumSub ¶
func (c Ring) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
func (Ring) RPopCount ¶
func (c Ring) RPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Ring) RestoreReplace ¶
func (Ring) SDiff ¶
func (c Ring) SDiff(context interface{}, keys ...string) *StringSliceCmd
func (Ring) SDiffStore ¶
func (Ring) SInter ¶
func (c Ring) SInter(context interface{}, keys ...string) *StringSliceCmd
func (Ring) SInterStore ¶
func (Ring) SMIsMember ¶
func (c Ring) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
SMIsMember Redis `SMISMEMBER key member [member ...]` command.
func (Ring) SMembers ¶
func (c Ring) SMembers(context interface{}, key string) *StringSliceCmd
SMembers Redis `SMEMBERS key` command output as a slice.
func (Ring) SMembersMap ¶
func (c Ring) SMembersMap(context interface{}, key string) *StringStructMapCmd
SMembersMap Redis `SMEMBERS key` command output as a map.
func (Ring) SPopN ¶
func (c Ring) SPopN(context interface{}, key string, count int64) *StringSliceCmd
SPopN Redis `SPOP key count` command.
func (Ring) SRandMember ¶
SRandMember Redis `SRANDMEMBER key` command.
func (Ring) SRandMemberN ¶
func (c Ring) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
SRandMemberN Redis `SRANDMEMBER key count` command.
func (Ring) SUnion ¶
func (c Ring) SUnion(context interface{}, keys ...string) *StringSliceCmd
func (Ring) SUnionStore ¶
func (Ring) ScriptExists ¶
func (c Ring) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
func (Ring) ScriptFlush ¶
func (c Ring) ScriptFlush(context interface{}) *StatusCmd
func (Ring) ScriptKill ¶
func (c Ring) ScriptKill(context interface{}) *StatusCmd
func (Ring) ScriptLoad ¶
func (Ring) Set ¶
func (c Ring) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
Set Redis `SET key value [expiration]` command. Use expiration for `SETEX`-like behavior.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Ring) SetArgs ¶
SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.
func (Ring) SetEX ¶
func (c Ring) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
SetEX Redis `SETEX key expiration value` command.
func (Ring) SetNX ¶
func (c Ring) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetNX Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Ring) SetXX ¶
func (c Ring) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetXX Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Ring) ShutdownNoSave ¶
func (c Ring) ShutdownNoSave(context interface{}) *StatusCmd
func (Ring) ShutdownSave ¶
func (c Ring) ShutdownSave(context interface{}) *StatusCmd
func (Ring) SlowLogGet ¶
func (c Ring) SlowLogGet(context interface{}, num int64) *SlowLogCmd
func (Ring) Sort ¶
func (c Ring) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
func (Ring) SortInterfaces ¶
func (Ring) TTL ¶
func (c Ring) TTL(context interface{}, key string) *DurationCmd
func (*Ring) TxPipeline ¶
func (*Ring) TxPipelined ¶
func (Ring) XAdd ¶
XAdd a.Limit has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046
func (Ring) XAutoClaim ¶
func (c Ring) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
func (Ring) XAutoClaimJustID ¶
func (c Ring) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
func (Ring) XClaim ¶
func (c Ring) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
func (Ring) XClaimJustID ¶
func (c Ring) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
func (Ring) XGroupCreate ¶
func (Ring) XGroupCreateConsumer ¶
func (Ring) XGroupCreateMkStream ¶
func (Ring) XGroupDelConsumer ¶
func (Ring) XGroupDestroy ¶
func (Ring) XGroupSetID ¶
func (Ring) XInfoConsumers ¶
func (c Ring) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
func (Ring) XInfoGroups ¶
func (c Ring) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
func (Ring) XInfoStream ¶
func (c Ring) XInfoStream(context interface{}, key string) *XInfoStreamCmd
func (Ring) XInfoStreamFull ¶
func (c Ring) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
XInfoStreamFull XINFO STREAM FULL [COUNT count] redis-server >= 6.0.
func (Ring) XPending ¶
func (c Ring) XPending(context interface{}, stream, group string) *XPendingCmd
func (Ring) XPendingExt ¶
func (c Ring) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
func (Ring) XRange ¶
func (c Ring) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Ring) XRangeN ¶
func (c Ring) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Ring) XRead ¶
func (c Ring) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
func (Ring) XReadGroup ¶
func (c Ring) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
func (Ring) XReadStreams ¶
func (c Ring) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
func (Ring) XRevRange ¶
func (c Ring) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Ring) XRevRangeN ¶
func (c Ring) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Ring) XTrimApprox
deprecated
func (Ring) XTrimMaxLen ¶
XTrimMaxLen No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MAXLEN maxLen
func (Ring) XTrimMaxLenApprox ¶
XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit
func (Ring) XTrimMinID ¶
XTrimMinID No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MINID minID
func (Ring) XTrimMinIDApprox ¶
XTrimMinIDApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MINID ~ minID LIMIT limit
func (Ring) ZAddArgsIncr ¶
func (Ring) ZAddCh ¶
ZAddCh Redis `ZADD key CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
Ch: true,
Members: []Z,
})
remove in v9.
func (Ring) ZAddNXCh ¶
ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
NX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Ring) ZAddXXCh ¶
ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
XX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Ring) ZDiff ¶
func (c Ring) ZDiff(context interface{}, keys ...string) *StringSliceCmd
ZDiff redis-server version >= 6.2.0.
func (Ring) ZDiffStore ¶
ZDiffStore redis-server version >=6.2.0.
func (Ring) ZDiffWithScores ¶
ZDiffWithScores redis-server version >= 6.2.0.
func (Ring) ZIncr ¶
ZIncr Redis `ZADD key INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
Members: []Z,
})
remove in v9.
func (Ring) ZIncrNX ¶
ZIncrNX Redis `ZADD key NX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
NX: true,
Members: []Z,
})
remove in v9.
func (Ring) ZIncrXX ¶
ZIncrXX Redis `ZADD key XX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
XX: true,
Members: []Z,
})
remove in v9.
func (Ring) ZInter ¶
func (c Ring) ZInter(context interface{}, store *ZStore) *StringSliceCmd
func (Ring) ZInterStore ¶
func (Ring) ZInterWithScores ¶
func (Ring) ZMScore ¶
func (c Ring) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
func (Ring) ZRandMember ¶
func (c Ring) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
ZRandMember redis-server version >= 6.2.0.
func (Ring) ZRange ¶
func (c Ring) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Ring) ZRangeArgs ¶
func (c Ring) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
func (Ring) ZRangeArgsWithScores ¶
func (c Ring) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
func (Ring) ZRangeByLex ¶
func (c Ring) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRangeByScore ¶
func (c Ring) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRangeByScoreWithScores ¶
func (Ring) ZRangeStore ¶
func (c Ring) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
func (Ring) ZRangeWithScores ¶
func (Ring) ZRemRangeByLex ¶
func (Ring) ZRemRangeByRank ¶
func (Ring) ZRemRangeByScore ¶
func (Ring) ZRevRange ¶
func (c Ring) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Ring) ZRevRangeByLex ¶
func (c Ring) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRevRangeByScore ¶
func (c Ring) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRevRangeByScoreWithScores ¶
func (Ring) ZRevRangeWithScores ¶
func (Ring) ZUnion ¶
func (c Ring) ZUnion(context interface{}, store ZStore) *StringSliceCmd
func (Ring) ZUnionStore ¶
func (Ring) ZUnionWithScores ¶
type RingOptions ¶
type RingOptions struct {
// Map of name => host:port addresses of ring shards.
Addrs map[string]string
// NewClient creates a shard client with provided name and options.
NewClient func(name string, opt *Options) *Client
// Frequency of PING commands sent to check shards availability.
// Shard is considered down after 3 subsequent failed checks.
HeartbeatFrequency time.Duration
// NewConsistentHash returns a consistent hash that is used
// to distribute keys across the shards.
//
// See https://medium.com/@dgryski/consistent-hashing-algorithmic-tradeoffs-ef6b8e2fcae8
// for consistent hashing algorithmic tradeoffs.
NewConsistentHash func(shards []string) ConsistentHash
Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
OnConnect func(ctx context.Context, cn *Conn) error
Username string
Password string
DB int
MaxRetries int
MinRetryBackoff time.Duration
MaxRetryBackoff time.Duration
DialTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
PoolFIFO bool
PoolSize int
MinIdleConns int
MaxConnAge time.Duration
PoolTimeout time.Duration
IdleTimeout time.Duration
IdleCheckFrequency time.Duration
TLSConfig *tls.Config
Limiter Limiter
}
RingOptions are used to configure a ring client and should be passed to NewRing.
type ScanCmd ¶
type ScanCmd struct {
// contains filtered or unexported fields
}
func NewScanCmd ¶
func NewScanCmdResult ¶
NewScanCmdResult returns a ScanCmd initialised with val and err for testing.
func (*ScanCmd) Iterator ¶
func (cmd *ScanCmd) Iterator() *ScanIterator
Iterator creates a new ScanIterator.
Example ¶
iter := rdb.Scan(ctx, 0, "", 0).Iterator()
for iter.Next(ctx) {
fmt.Println(iter.Val())
}
if err := iter.Err(); err != nil {
panic(err)
}
type ScanIterator ¶
type ScanIterator struct {
// contains filtered or unexported fields
}
ScanIterator is used to incrementally iterate over a collection of elements. It's safe for concurrent use by multiple goroutines.
Example ¶
iter := rdb.Scan(ctx, 0, "", 0).Iterator()
for iter.Next(ctx) {
fmt.Println(iter.Val())
}
if err := iter.Err(); err != nil {
panic(err)
}
func (*ScanIterator) Err ¶
func (it *ScanIterator) Err() error
Err returns the last iterator error, if any.
func (*ScanIterator) Next ¶
func (it *ScanIterator) Next(ctx context.Context) bool
Next advances the cursor and returns true if more values can be read.
func (*ScanIterator) Val ¶
func (it *ScanIterator) Val() string
Val returns the key/field at the current cursor position.
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
Example ¶
IncrByXX := redis.NewScript(`
if redis.call("GET", KEYS[1]) ~= false then
return redis.call("INCRBY", KEYS[1], ARGV[1])
end
return false
`)
n, err := IncrByXX.Run(ctx, rdb, []string{"xx_counter"}, 2).Result()
fmt.Println(n, err)
err = rdb.Set(ctx, "xx_counter", "40", 0).Err()
if err != nil {
panic(err)
}
n, err = IncrByXX.Run(ctx, rdb, []string{"xx_counter"}, 2).Result()
fmt.Println(n, err)
Output: <nil> redis: nil 42 <nil>
type Scripter ¶
type Scripter interface {
Eval(ctx interface{}, script string, keys []string, args ...interface{}) *Cmd
EvalSha(ctx interface{}, sha1 string, keys []string, args ...interface{}) *Cmd
ScriptExists(ctx interface{}, hashes ...string) *BoolSliceCmd
ScriptLoad(ctx interface{}, script string) *StringCmd
}
type SentinelClient ¶
type SentinelClient struct {
// contains filtered or unexported fields
}
SentinelClient is a client for a Redis Sentinel.
func NewSentinelClient ¶
func NewSentinelClient(opt *Options) *SentinelClient
func (*SentinelClient) CkQuorum ¶
func (c *SentinelClient) CkQuorum(ctx context.Context, name string) *StringCmd
CkQuorum checks if the current Sentinel configuration is able to reach the quorum needed to failover a master, and the majority needed to authorize the failover. This command should be used in monitoring systems to check if a Sentinel deployment is ok.
func (SentinelClient) Close ¶
func (c SentinelClient) Close() error
Close closes the client, releasing any open resources.
It is rare to Close a Client, as the Client is meant to be long-lived and shared between many goroutines.
func (*SentinelClient) Context ¶
func (c *SentinelClient) Context() context.Context
func (*SentinelClient) Failover ¶
func (c *SentinelClient) Failover(ctx context.Context, name string) *StatusCmd
Failover forces a failover as if the master was not reachable, and without asking for agreement to other Sentinels.
func (*SentinelClient) FlushConfig ¶
func (c *SentinelClient) FlushConfig(ctx context.Context) *StatusCmd
FlushConfig forces Sentinel to rewrite its configuration on disk, including the current Sentinel state.
func (*SentinelClient) GetMasterAddrByName ¶
func (c *SentinelClient) GetMasterAddrByName(ctx context.Context, name string) *StringSliceCmd
func (*SentinelClient) Master ¶
func (c *SentinelClient) Master(ctx context.Context, name string) *StringStringMapCmd
Master shows the state and info of the specified master.
func (*SentinelClient) Masters ¶
func (c *SentinelClient) Masters(ctx context.Context) *SliceCmd
Masters shows a list of monitored masters and their state.
func (*SentinelClient) Monitor ¶
func (c *SentinelClient) Monitor(ctx context.Context, name, ip, port, quorum string) *StringCmd
Monitor tells the Sentinel to start monitoring a new master with the specified name, ip, port, and quorum.
func (*SentinelClient) PSubscribe ¶
func (c *SentinelClient) PSubscribe(ctx context.Context, channels ...string) *PubSub
PSubscribe subscribes the client to the given patterns. Patterns can be omitted to create empty subscription.
func (*SentinelClient) Ping ¶
func (c *SentinelClient) Ping(ctx context.Context) *StringCmd
Ping is used to test if a connection is still alive, or to measure latency.
func (*SentinelClient) Process ¶
func (c *SentinelClient) Process(ctx context.Context, cmd Cmder) error
func (*SentinelClient) Remove ¶
func (c *SentinelClient) Remove(ctx context.Context, name string) *StringCmd
Remove is used in order to remove the specified master: the master will no longer be monitored, and will totally be removed from the internal state of the Sentinel.
func (*SentinelClient) Reset ¶
func (c *SentinelClient) Reset(ctx context.Context, pattern string) *IntCmd
Reset resets all the masters with matching name. The pattern argument is a glob-style pattern. The reset process clears any previous state in a master (including a failover in progress), and removes every slave and sentinel already discovered and associated with the master.
func (*SentinelClient) Sentinels ¶
func (c *SentinelClient) Sentinels(ctx context.Context, name string) *SliceCmd
func (*SentinelClient) Set ¶
func (c *SentinelClient) Set(ctx context.Context, name, option, value string) *StringCmd
Set is used in order to change configuration parameters of a specific master.
func (*SentinelClient) Slaves ¶
func (c *SentinelClient) Slaves(ctx context.Context, name string) *SliceCmd
Slaves shows a list of slaves for the specified master and their state.
func (*SentinelClient) Subscribe ¶
func (c *SentinelClient) Subscribe(ctx context.Context, channels ...string) *PubSub
Subscribe subscribes the client to the specified channels. Channels can be omitted to create empty subscription.
func (*SentinelClient) WithContext ¶
func (c *SentinelClient) WithContext(ctx context.Context) *SentinelClient
type SetArgs ¶
type SetArgs struct {
// Mode can be `NX` or `XX` or empty.
Mode string
// Zero `TTL` or `Expiration` means that the key has no expiration time.
TTL time.Duration
ExpireAt time.Time
// When Get is true, the command returns the old value stored at key, or nil when key did not exist.
Get bool
// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
// otherwise you will receive an error: (error) ERR syntax error.
KeepTTL bool
}
SetArgs provides arguments for the SetArgs function.
type SliceCmd ¶
type SliceCmd struct {
// contains filtered or unexported fields
}
func NewSliceCmd ¶
func NewSliceResult ¶
NewSliceResult returns a SliceCmd initialised with val and err for testing.
func (*SliceCmd) Scan ¶
Scan scans the results from the map into a destination struct. The map keys are matched in the Redis struct fields by the `redis:"field"` tag.
Example ¶
ExampleSliceCmd_Scan shows how to scan the results of a multi key fetch into a struct.
rdb.FlushDB(ctx)
err := rdb.MSet(ctx,
"name", "hello",
"count", 123,
"correct", true).Err()
if err != nil {
panic(err)
}
res := rdb.MGet(ctx, "name", "count", "empty", "correct")
if res.Err() != nil {
panic(err)
}
type data struct {
Name string `redis:"name"`
Count int `redis:"count"`
Correct bool `redis:"correct"`
}
// Scan the results into the struct.
var d data
if err := res.Scan(&d); err != nil {
panic(err)
}
fmt.Println(d)
Output: {hello 123 true}
type SlowLogCmd ¶
type SlowLogCmd struct {
// contains filtered or unexported fields
}
func NewSlowLogCmd ¶
func NewSlowLogCmd(ctx context.Context, args ...interface{}) *SlowLogCmd
func (*SlowLogCmd) Result ¶
func (cmd *SlowLogCmd) Result() ([]SlowLog, error)
func (*SlowLogCmd) String ¶
func (cmd *SlowLogCmd) String() string
func (*SlowLogCmd) Val ¶
func (cmd *SlowLogCmd) Val() []SlowLog
type StatefulCmdable ¶
type StatefulCmdable interface {
Cmdable
Auth(ctx context.Context, password string) *StatusCmd
AuthACL(ctx context.Context, username, password string) *StatusCmd
Select(ctx context.Context, index int) *StatusCmd
SwapDB(ctx context.Context, index1, index2 int) *StatusCmd
ClientSetName(ctx context.Context, name string) *BoolCmd
}
type StatusCmd ¶
type StatusCmd struct {
// contains filtered or unexported fields
}
func NewStatusCmd ¶
func NewStatusResult ¶
NewStatusResult returns a StatusCmd initialised with val and err for testing.
type StringCmd ¶
type StringCmd struct {
// contains filtered or unexported fields
}
func NewStringCmd ¶
func NewStringResult ¶
NewStringResult returns a StringCmd initialised with val and err for testing.
type StringIntMapCmd ¶
type StringIntMapCmd struct {
// contains filtered or unexported fields
}
func NewStringIntMapCmd ¶
func NewStringIntMapCmd(ctx context.Context, args ...interface{}) *StringIntMapCmd
func NewStringIntMapCmdResult ¶
func NewStringIntMapCmdResult(val map[string]int64, err error) *StringIntMapCmd
NewStringIntMapCmdResult returns a StringIntMapCmd initialised with val and err for testing.
func (*StringIntMapCmd) String ¶
func (cmd *StringIntMapCmd) String() string
func (*StringIntMapCmd) Val ¶
func (cmd *StringIntMapCmd) Val() map[string]int64
type StringSliceCmd ¶
type StringSliceCmd struct {
// contains filtered or unexported fields
}
func NewStringSliceCmd ¶
func NewStringSliceCmd(ctx context.Context, args ...interface{}) *StringSliceCmd
func NewStringSliceResult ¶
func NewStringSliceResult(val []string, err error) *StringSliceCmd
NewStringSliceResult returns a StringSliceCmd initialised with val and err for testing.
func (*StringSliceCmd) Result ¶
func (cmd *StringSliceCmd) Result() ([]string, error)
func (*StringSliceCmd) ScanSlice ¶
func (cmd *StringSliceCmd) ScanSlice(container interface{}) error
func (*StringSliceCmd) String ¶
func (cmd *StringSliceCmd) String() string
func (*StringSliceCmd) Val ¶
func (cmd *StringSliceCmd) Val() []string
type StringStringMapCmd ¶
type StringStringMapCmd struct {
// contains filtered or unexported fields
}
func NewStringStringMapCmd ¶
func NewStringStringMapCmd(ctx context.Context, args ...interface{}) *StringStringMapCmd
func NewStringStringMapResult ¶
func NewStringStringMapResult(val map[string]string, err error) *StringStringMapCmd
NewStringStringMapResult returns a StringStringMapCmd initialised with val and err for testing.
func (*StringStringMapCmd) Result ¶
func (cmd *StringStringMapCmd) Result() (map[string]string, error)
func (*StringStringMapCmd) Scan ¶
func (cmd *StringStringMapCmd) Scan(dst interface{}) error
Scan scans the results from the map into a destination struct. The map keys are matched in the Redis struct fields by the `redis:"field"` tag.
Example ¶
ExampleStringStringMapCmd_Scan shows how to scan the results of a map fetch into a struct.
rdb.FlushDB(ctx)
err := rdb.HMSet(ctx, "map",
"name", "hello",
"count", 123,
"correct", true).Err()
if err != nil {
panic(err)
}
// Get the map. The same approach works for HmGet().
res := rdb.HGetAll(ctx, "map")
if res.Err() != nil {
panic(err)
}
type data struct {
Name string `redis:"name"`
Count int `redis:"count"`
Correct bool `redis:"correct"`
}
// Scan the results into the struct.
var d data
if err := res.Scan(&d); err != nil {
panic(err)
}
fmt.Println(d)
Output: {hello 123 true}
func (*StringStringMapCmd) String ¶
func (cmd *StringStringMapCmd) String() string
func (*StringStringMapCmd) Val ¶
func (cmd *StringStringMapCmd) Val() map[string]string
type StringStructMapCmd ¶
type StringStructMapCmd struct {
// contains filtered or unexported fields
}
func NewStringStructMapCmd ¶
func NewStringStructMapCmd(ctx context.Context, args ...interface{}) *StringStructMapCmd
func (*StringStructMapCmd) Result ¶
func (cmd *StringStructMapCmd) Result() (map[string]struct{}, error)
func (*StringStructMapCmd) String ¶
func (cmd *StringStructMapCmd) String() string
func (*StringStructMapCmd) Val ¶
func (cmd *StringStructMapCmd) Val() map[string]struct{}
type Subscription ¶
type Subscription struct {
// Can be "subscribe", "unsubscribe", "psubscribe" or "punsubscribe".
Kind string
// Channel name we have subscribed to.
Channel string
// Number of channels we are currently subscribed to.
Count int
}
Subscription received after a successful subscription to channel.
func (*Subscription) String ¶
func (m *Subscription) String() string
type TimeCmd ¶
type TimeCmd struct {
// contains filtered or unexported fields
}
func NewTimeCmd ¶
func NewTimeCmdResult ¶
NewTimeCmdResult returns a TimeCmd initialised with val and err for testing.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx implements Redis transactions as described in http://redis.io/topics/transactions. It's NOT safe for concurrent use by multiple goroutines, because Exec resets list of watched keys. If you don't need WATCH it is better to use Pipeline.
func (Tx) AuthACL ¶
AuthACL Perform an AUTH command, using the given user and pass. Should be used to authenticate the current connection with one of the connections defined in the ACL list when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system.
func (Tx) BLPop ¶
func (c Tx) BLPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (Tx) BRPop ¶
func (c Tx) BRPop(context interface{}, timeout time.Duration, keys ...string) *StringSliceCmd
func (Tx) BRPopLPush ¶
func (Tx) BZPopMax ¶
func (c Tx) BZPopMax(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.
func (Tx) BZPopMin ¶
func (c Tx) BZPopMin(context interface{}, timeout time.Duration, keys ...string) *ZWithKeyCmd
BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.
func (Tx) BgRewriteAOF ¶
func (c Tx) BgRewriteAOF(context interface{}) *StatusCmd
func (Tx) BitField ¶
func (c Tx) BitField(context interface{}, key string, args ...interface{}) *IntSliceCmd
func (Tx) ClientGetName ¶
func (c Tx) ClientGetName(context interface{}) *StringCmd
ClientGetName returns the name of the connection.
func (Tx) ClientKill ¶
func (Tx) ClientKillByFilter ¶
ClientKillByFilter is new style syntax, while the ClientKill is old
CLIENT KILL <option> [value] ... <option> [value]
func (Tx) ClientList ¶
func (c Tx) ClientList(context interface{}) *StringCmd
func (Tx) ClientPause ¶
func (Tx) ClientSetName ¶
ClientSetName assigns a name to the connection.
func (Tx) ClientUnblock ¶
func (Tx) ClientUnblockWithError ¶
func (Tx) ClusterAddSlots ¶
func (Tx) ClusterAddSlotsRange ¶
func (Tx) ClusterCountFailureReports ¶
func (Tx) ClusterCountKeysInSlot ¶
func (Tx) ClusterDelSlots ¶
func (Tx) ClusterDelSlotsRange ¶
func (Tx) ClusterFailover ¶
func (c Tx) ClusterFailover(context interface{}) *StatusCmd
func (Tx) ClusterForget ¶
func (Tx) ClusterGetKeysInSlot ¶
func (c Tx) ClusterGetKeysInSlot(context interface{}, slot int, count int) *StringSliceCmd
func (Tx) ClusterInfo ¶
func (c Tx) ClusterInfo(context interface{}) *StringCmd
func (Tx) ClusterKeySlot ¶
func (Tx) ClusterMeet ¶
func (Tx) ClusterNodes ¶
func (c Tx) ClusterNodes(context interface{}) *StringCmd
func (Tx) ClusterReplicate ¶
func (Tx) ClusterResetHard ¶
func (c Tx) ClusterResetHard(context interface{}) *StatusCmd
func (Tx) ClusterResetSoft ¶
func (c Tx) ClusterResetSoft(context interface{}) *StatusCmd
func (Tx) ClusterSaveConfig ¶
func (c Tx) ClusterSaveConfig(context interface{}) *StatusCmd
func (Tx) ClusterSlaves ¶
func (c Tx) ClusterSlaves(context interface{}, nodeID string) *StringSliceCmd
func (Tx) ClusterSlots ¶
func (c Tx) ClusterSlots(context interface{}) *ClusterSlotsCmd
func (Tx) Command ¶
func (c Tx) Command(context interface{}) *CommandsInfoCmd
func (Tx) ConfigResetStat ¶
func (c Tx) ConfigResetStat(context interface{}) *StatusCmd
func (Tx) ConfigRewrite ¶
func (c Tx) ConfigRewrite(context interface{}) *StatusCmd
func (Tx) DebugObject ¶
func (Tx) FlushAllAsync ¶
func (c Tx) FlushAllAsync(context interface{}) *StatusCmd
func (Tx) FlushDBAsync ¶
func (c Tx) FlushDBAsync(context interface{}) *StatusCmd
func (Tx) GeoAdd ¶
func (c Tx) GeoAdd(context interface{}, key string, geoLocation ...*GeoLocation) *IntCmd
func (Tx) GeoHash ¶
func (c Tx) GeoHash(context interface{}, key string, members ...string) *StringSliceCmd
func (Tx) GeoRadius ¶
func (c Tx) GeoRadius(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Tx) GeoRadiusByMember ¶
func (c Tx) GeoRadiusByMember(
context interface{}, key, member string, query *GeoRadiusQuery,
) *GeoLocationCmd
GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.
func (Tx) GeoRadiusByMemberStore ¶
func (c Tx) GeoRadiusByMemberStore(
context interface{}, key, member string, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Tx) GeoRadiusStore ¶
func (c Tx) GeoRadiusStore(
context interface{}, key string, longitude, latitude float64, query *GeoRadiusQuery,
) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Tx) GeoSearch ¶
func (c Tx) GeoSearch(context interface{}, key string, q *GeoSearchQuery) *StringSliceCmd
func (Tx) GeoSearchLocation ¶
func (c Tx) GeoSearchLocation(
context interface{}, key string, q *GeoSearchLocationQuery,
) *GeoSearchLocationCmd
func (Tx) GeoSearchStore ¶
func (c Tx) GeoSearchStore(context interface{}, key, store string, q *GeoSearchStoreQuery) *IntCmd
func (Tx) GetEx ¶
GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist). Requires Redis >= 6.2.0.
func (Tx) HGetAll ¶
func (c Tx) HGetAll(context interface{}, key string) *StringStringMapCmd
func (Tx) HIncrByFloat ¶
func (Tx) HKeys ¶
func (c Tx) HKeys(context interface{}, key string) *StringSliceCmd
func (Tx) HMGet ¶
HMGet returns the values for the specified fields in the hash stored at key. It returns an interface{} to distinguish between empty string and nil value.
func (Tx) HRandField ¶
func (c Tx) HRandField(context interface{}, key string, count int, withValues bool) *StringSliceCmd
HRandField redis-server version >= 6.2.0.
func (Tx) HSet ¶
HSet accepts values in following formats:
- HSet("myhash", "key1", "value1", "key2", "value2")
- HSet("myhash", []string{"key1", "value1", "key2", "value2"})
- HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it requires Redis v4 for multiple field/value pairs support.
func (Tx) HVals ¶
func (c Tx) HVals(context interface{}, key string) *StringSliceCmd
func (Tx) IncrByFloat ¶
func (Tx) Keys ¶
func (c Tx) Keys(context interface{}, pattern string) *StringSliceCmd
func (Tx) LInsertAfter ¶
func (Tx) LInsertBefore ¶
func (Tx) LPopCount ¶
func (c Tx) LPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Tx) LPosCount ¶
func (c Tx) LPosCount(context interface{}, key string, value string, count int64, a LPosArgs) *IntSliceCmd
func (Tx) LRange ¶
func (c Tx) LRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Tx) MSet ¶
func (c Tx) MSet(context interface{}, values ...interface{}) *StatusCmd
MSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Tx) MSetNX ¶
func (c Tx) MSetNX(context interface{}, values ...interface{}) *BoolCmd
MSetNX is like SetNX but accepts multiple values:
- MSetNX("key1", "value1", "key2", "value2")
- MSetNX([]string{"key1", "value1", "key2", "value2"})
- MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (Tx) MemoryUsage ¶
func (Tx) ObjectEncoding ¶
func (Tx) ObjectIdleTime ¶
func (c Tx) ObjectIdleTime(context interface{}, key string) *DurationCmd
func (Tx) ObjectRefCount ¶
func (Tx) PTTL ¶
func (c Tx) PTTL(context interface{}, key string) *DurationCmd
func (*Tx) Pipelined ¶
Pipelined executes commands queued in the fn outside of the transaction. Use TxPipelined if you need transactional behavior.
func (Tx) PubSubChannels ¶
func (c Tx) PubSubChannels(context interface{}, pattern string) *StringSliceCmd
func (Tx) PubSubNumPat ¶
func (c Tx) PubSubNumPat(context interface{}) *IntCmd
func (Tx) PubSubNumSub ¶
func (c Tx) PubSubNumSub(context interface{}, channels ...string) *StringIntMapCmd
func (Tx) RPopCount ¶
func (c Tx) RPopCount(context interface{}, key string, count int) *StringSliceCmd
func (Tx) RestoreReplace ¶
func (Tx) SDiff ¶
func (c Tx) SDiff(context interface{}, keys ...string) *StringSliceCmd
func (Tx) SDiffStore ¶
func (Tx) SInter ¶
func (c Tx) SInter(context interface{}, keys ...string) *StringSliceCmd
func (Tx) SInterStore ¶
func (Tx) SMIsMember ¶
func (c Tx) SMIsMember(context interface{}, key string, members ...interface{}) *BoolSliceCmd
SMIsMember Redis `SMISMEMBER key member [member ...]` command.
func (Tx) SMembers ¶
func (c Tx) SMembers(context interface{}, key string) *StringSliceCmd
SMembers Redis `SMEMBERS key` command output as a slice.
func (Tx) SMembersMap ¶
func (c Tx) SMembersMap(context interface{}, key string) *StringStructMapCmd
SMembersMap Redis `SMEMBERS key` command output as a map.
func (Tx) SPopN ¶
func (c Tx) SPopN(context interface{}, key string, count int64) *StringSliceCmd
SPopN Redis `SPOP key count` command.
func (Tx) SRandMember ¶
SRandMember Redis `SRANDMEMBER key` command.
func (Tx) SRandMemberN ¶
func (c Tx) SRandMemberN(context interface{}, key string, count int64) *StringSliceCmd
SRandMemberN Redis `SRANDMEMBER key count` command.
func (Tx) SUnion ¶
func (c Tx) SUnion(context interface{}, keys ...string) *StringSliceCmd
func (Tx) SUnionStore ¶
func (Tx) ScriptExists ¶
func (c Tx) ScriptExists(context interface{}, hashes ...string) *BoolSliceCmd
func (Tx) ScriptFlush ¶
func (c Tx) ScriptFlush(context interface{}) *StatusCmd
func (Tx) ScriptKill ¶
func (c Tx) ScriptKill(context interface{}) *StatusCmd
func (Tx) ScriptLoad ¶
func (Tx) Set ¶
func (c Tx) Set(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
Set Redis `SET key value [expiration]` command. Use expiration for `SETEX`-like behavior.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Tx) SetArgs ¶
SetArgs supports all the options that the SET command supports. It is the alternative to the Set function when you want to have more control over the options.
func (Tx) SetEX ¶
func (c Tx) SetEX(context interface{}, key string, value interface{}, expiration time.Duration) *StatusCmd
SetEX Redis `SETEX key expiration value` command.
func (Tx) SetNX ¶
func (c Tx) SetNX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetNX Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Tx) SetXX ¶
func (c Tx) SetXX(context interface{}, key string, value interface{}, expiration time.Duration) *BoolCmd
SetXX Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time. KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0, otherwise you will receive an error: (error) ERR syntax error.
func (Tx) ShutdownNoSave ¶
func (c Tx) ShutdownNoSave(context interface{}) *StatusCmd
func (Tx) ShutdownSave ¶
func (c Tx) ShutdownSave(context interface{}) *StatusCmd
func (Tx) SlowLogGet ¶
func (c Tx) SlowLogGet(context interface{}, num int64) *SlowLogCmd
func (Tx) Sort ¶
func (c Tx) Sort(context interface{}, key string, sort *Sort) *StringSliceCmd
func (Tx) SortInterfaces ¶
func (Tx) TTL ¶
func (c Tx) TTL(context interface{}, key string) *DurationCmd
func (*Tx) TxPipeline ¶
TxPipeline creates a pipeline. Usually it is more convenient to use TxPipelined.
func (*Tx) TxPipelined ¶
TxPipelined executes commands queued in the fn in the transaction.
When using WATCH, EXEC will execute commands only if the watched keys were not modified, allowing for a check-and-set mechanism.
Exec always returns list of commands. If transaction fails TxFailedErr is returned. Otherwise Exec returns an error of the first failed command or nil.
func (Tx) XAdd ¶
XAdd a.Limit has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046
func (Tx) XAutoClaim ¶
func (c Tx) XAutoClaim(context interface{}, a *XAutoClaimArgs) *XAutoClaimCmd
func (Tx) XAutoClaimJustID ¶
func (c Tx) XAutoClaimJustID(context interface{}, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
func (Tx) XClaim ¶
func (c Tx) XClaim(context interface{}, a *XClaimArgs) *XMessageSliceCmd
func (Tx) XClaimJustID ¶
func (c Tx) XClaimJustID(context interface{}, a *XClaimArgs) *StringSliceCmd
func (Tx) XGroupCreate ¶
func (Tx) XGroupCreateConsumer ¶
func (Tx) XGroupCreateMkStream ¶
func (Tx) XGroupDelConsumer ¶
func (Tx) XGroupDestroy ¶
func (Tx) XGroupSetID ¶
func (Tx) XInfoConsumers ¶
func (c Tx) XInfoConsumers(context interface{}, key string, group string) *XInfoConsumersCmd
func (Tx) XInfoGroups ¶
func (c Tx) XInfoGroups(context interface{}, key string) *XInfoGroupsCmd
func (Tx) XInfoStream ¶
func (c Tx) XInfoStream(context interface{}, key string) *XInfoStreamCmd
func (Tx) XInfoStreamFull ¶
func (c Tx) XInfoStreamFull(context interface{}, key string, count int) *XInfoStreamFullCmd
XInfoStreamFull XINFO STREAM FULL [COUNT count] redis-server >= 6.0.
func (Tx) XPending ¶
func (c Tx) XPending(context interface{}, stream, group string) *XPendingCmd
func (Tx) XPendingExt ¶
func (c Tx) XPendingExt(context interface{}, a *XPendingExtArgs) *XPendingExtCmd
func (Tx) XRange ¶
func (c Tx) XRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Tx) XRangeN ¶
func (c Tx) XRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Tx) XRead ¶
func (c Tx) XRead(context interface{}, a *XReadArgs) *XStreamSliceCmd
func (Tx) XReadGroup ¶
func (c Tx) XReadGroup(context interface{}, a *XReadGroupArgs) *XStreamSliceCmd
func (Tx) XReadStreams ¶
func (c Tx) XReadStreams(context interface{}, streams ...string) *XStreamSliceCmd
func (Tx) XRevRange ¶
func (c Tx) XRevRange(context interface{}, stream, start, stop string) *XMessageSliceCmd
func (Tx) XRevRangeN ¶
func (c Tx) XRevRangeN(context interface{}, stream, start, stop string, count int64) *XMessageSliceCmd
func (Tx) XTrimApprox
deprecated
func (Tx) XTrimMaxLen ¶
XTrimMaxLen No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MAXLEN maxLen
func (Tx) XTrimMaxLenApprox ¶
XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit
func (Tx) XTrimMinID ¶
XTrimMinID No `~` rules are used, `limit` cannot be used. cmd: XTRIM key MINID minID
func (Tx) XTrimMinIDApprox ¶
XTrimMinIDApprox LIMIT has a bug, please confirm it and use it. issue: https://github.com/redis/redis/issues/9046 cmd: XTRIM key MINID ~ minID LIMIT limit
func (Tx) ZAddArgsIncr ¶
func (Tx) ZAddCh ¶
ZAddCh Redis `ZADD key CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
Ch: true,
Members: []Z,
})
remove in v9.
func (Tx) ZAddNXCh ¶
ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
NX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Tx) ZAddXXCh ¶
ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command. Deprecated: Use
client.ZAddArgs(ctx, ZAddArgs{
XX: true,
Ch: true,
Members: []Z,
})
remove in v9.
func (Tx) ZDiff ¶
func (c Tx) ZDiff(context interface{}, keys ...string) *StringSliceCmd
ZDiff redis-server version >= 6.2.0.
func (Tx) ZDiffStore ¶
ZDiffStore redis-server version >=6.2.0.
func (Tx) ZDiffWithScores ¶
ZDiffWithScores redis-server version >= 6.2.0.
func (Tx) ZIncr ¶
ZIncr Redis `ZADD key INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
Members: []Z,
})
remove in v9.
func (Tx) ZIncrNX ¶
ZIncrNX Redis `ZADD key NX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
NX: true,
Members: []Z,
})
remove in v9.
func (Tx) ZIncrXX ¶
ZIncrXX Redis `ZADD key XX INCR score member` command. Deprecated: Use
client.ZAddArgsIncr(ctx, ZAddArgs{
XX: true,
Members: []Z,
})
remove in v9.
func (Tx) ZInter ¶
func (c Tx) ZInter(context interface{}, store *ZStore) *StringSliceCmd
func (Tx) ZInterStore ¶
func (Tx) ZInterWithScores ¶
func (Tx) ZMScore ¶
func (c Tx) ZMScore(context interface{}, key string, members ...string) *FloatSliceCmd
func (Tx) ZRandMember ¶
func (c Tx) ZRandMember(context interface{}, key string, count int, withScores bool) *StringSliceCmd
ZRandMember redis-server version >= 6.2.0.
func (Tx) ZRange ¶
func (c Tx) ZRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Tx) ZRangeArgs ¶
func (c Tx) ZRangeArgs(context interface{}, z ZRangeArgs) *StringSliceCmd
func (Tx) ZRangeArgsWithScores ¶
func (c Tx) ZRangeArgsWithScores(context interface{}, z ZRangeArgs) *ZSliceCmd
func (Tx) ZRangeByLex ¶
func (c Tx) ZRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRangeByScore ¶
func (c Tx) ZRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRangeByScoreWithScores ¶
func (Tx) ZRangeStore ¶
func (c Tx) ZRangeStore(context interface{}, dst string, z ZRangeArgs) *IntCmd
func (Tx) ZRangeWithScores ¶
func (Tx) ZRemRangeByLex ¶
func (Tx) ZRemRangeByRank ¶
func (Tx) ZRemRangeByScore ¶
func (Tx) ZRevRange ¶
func (c Tx) ZRevRange(context interface{}, key string, start, stop int64) *StringSliceCmd
func (Tx) ZRevRangeByLex ¶
func (c Tx) ZRevRangeByLex(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRevRangeByScore ¶
func (c Tx) ZRevRangeByScore(context interface{}, key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRevRangeByScoreWithScores ¶
func (Tx) ZRevRangeWithScores ¶
func (Tx) ZUnion ¶
func (c Tx) ZUnion(context interface{}, store ZStore) *StringSliceCmd
func (Tx) ZUnionStore ¶
func (Tx) ZUnionWithScores ¶
type UniversalClient ¶
type UniversalClient interface {
Cmdable
Context() context.Context
AddHook(Hook)
Watch(ctx context.Context, fn func(*Tx) error, keys ...string) error
Do(ctx context.Context, args ...interface{}) *Cmd
Process(ctx context.Context, cmd Cmder) error
Subscribe(ctx context.Context, channels ...string) *PubSub
PSubscribe(ctx context.Context, channels ...string) *PubSub
Close() error
PoolStats() *PoolStats
}
UniversalClient is an abstract client which - based on the provided options - represents either a ClusterClient, a FailoverClient, or a single-node Client. This can be useful for testing cluster-specific applications locally or having different clients in different environments.
func NewUniversalClient ¶
func NewUniversalClient(opts *UniversalOptions) UniversalClient
NewUniversalClient returns a new multi client. The type of the returned client depends on the following conditions:
1. If the MasterName option is specified, a sentinel-backed FailoverClient is returned. 2. if the number of Addrs is two or more, a ClusterClient is returned. 3. Otherwise, a single-node Client is returned.
Example (Cluster) ¶
rdb := redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},
})
defer rdb.Close()
rdb.Ping(ctx)
Example (Failover) ¶
rdb := redis.NewUniversalClient(&redis.UniversalOptions{
MasterName: "master",
Addrs: []string{":26379"},
})
defer rdb.Close()
rdb.Ping(ctx)
Example (Simple) ¶
rdb := redis.NewUniversalClient(&redis.UniversalOptions{
Addrs: []string{":6379"},
})
defer rdb.Close()
rdb.Ping(ctx)
type UniversalOptions ¶
type UniversalOptions struct {
// Either a single address or a seed list of host:port addresses
// of cluster/sentinel nodes.
Addrs []string
// Database to be selected after connecting to the server.
// Only single-node and failover clients.
DB int
Dialer func(ctx context.Context, network, addr string) (net.Conn, error)
OnConnect func(ctx context.Context, cn *Conn) error
Username string
Password string
SentinelPassword string
MaxRetries int
MinRetryBackoff time.Duration
MaxRetryBackoff time.Duration
DialTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).
PoolFIFO bool
PoolSize int
MinIdleConns int
MaxConnAge time.Duration
PoolTimeout time.Duration
IdleTimeout time.Duration
IdleCheckFrequency time.Duration
TLSConfig *tls.Config
MaxRedirects int
ReadOnly bool
RouteByLatency bool
RouteRandomly bool
MasterName string
}
UniversalOptions information is required by UniversalClient to establish connections.
func (*UniversalOptions) Cluster ¶
func (o *UniversalOptions) Cluster() *ClusterOptions
Cluster returns cluster options created from the universal options.
func (*UniversalOptions) Failover ¶
func (o *UniversalOptions) Failover() *FailoverOptions
Failover returns failover options created from the universal options.
func (*UniversalOptions) Simple ¶
func (o *UniversalOptions) Simple() *Options
Simple returns basic options created from the universal options.
type XAddArgs ¶
type XAddArgs struct {
Stream string
NoMkStream bool
MaxLen int64 // MAXLEN N
// Deprecated: use MaxLen+Approx, remove in v9.
MaxLenApprox int64 // MAXLEN ~ N
MinID string
// Approx causes MaxLen and MinID to use "~" matcher (instead of "=").
Approx bool
Limit int64
ID string
Values interface{}
}
XAddArgs accepts values in the following formats:
- XAddArgs.Values = []interface{}{"key1", "value1", "key2", "value2"}
- XAddArgs.Values = []string("key1", "value1", "key2", "value2")
- XAddArgs.Values = map[string]interface{}{"key1": "value1", "key2": "value2"}
Note that map will not preserve the order of key-value pairs. MaxLen/MaxLenApprox and MinID are in conflict, only one of them can be used.
type XAutoClaimArgs ¶
type XAutoClaimCmd ¶
type XAutoClaimCmd struct {
// contains filtered or unexported fields
}
func NewXAutoClaimCmd ¶
func NewXAutoClaimCmd(ctx context.Context, args ...interface{}) *XAutoClaimCmd
func (*XAutoClaimCmd) Result ¶
func (cmd *XAutoClaimCmd) Result() (messages []XMessage, start string, err error)
func (*XAutoClaimCmd) String ¶
func (cmd *XAutoClaimCmd) String() string
func (*XAutoClaimCmd) Val ¶
func (cmd *XAutoClaimCmd) Val() (messages []XMessage, start string)
type XAutoClaimJustIDCmd ¶
type XAutoClaimJustIDCmd struct {
// contains filtered or unexported fields
}
func NewXAutoClaimJustIDCmd ¶
func NewXAutoClaimJustIDCmd(ctx context.Context, args ...interface{}) *XAutoClaimJustIDCmd
func (*XAutoClaimJustIDCmd) Result ¶
func (cmd *XAutoClaimJustIDCmd) Result() (ids []string, start string, err error)
func (*XAutoClaimJustIDCmd) String ¶
func (cmd *XAutoClaimJustIDCmd) String() string
func (*XAutoClaimJustIDCmd) Val ¶
func (cmd *XAutoClaimJustIDCmd) Val() (ids []string, start string)
type XClaimArgs ¶
type XInfoConsumer ¶
type XInfoConsumersCmd ¶
type XInfoConsumersCmd struct {
// contains filtered or unexported fields
}
func NewXInfoConsumersCmd ¶
func NewXInfoConsumersCmd(ctx context.Context, stream string, group string) *XInfoConsumersCmd
func (*XInfoConsumersCmd) Result ¶
func (cmd *XInfoConsumersCmd) Result() ([]XInfoConsumer, error)
func (*XInfoConsumersCmd) String ¶
func (cmd *XInfoConsumersCmd) String() string
func (*XInfoConsumersCmd) Val ¶
func (cmd *XInfoConsumersCmd) Val() []XInfoConsumer
type XInfoGroup ¶
type XInfoGroupsCmd ¶
type XInfoGroupsCmd struct {
// contains filtered or unexported fields
}
func NewXInfoGroupsCmd ¶
func NewXInfoGroupsCmd(ctx context.Context, stream string) *XInfoGroupsCmd
func (*XInfoGroupsCmd) Result ¶
func (cmd *XInfoGroupsCmd) Result() ([]XInfoGroup, error)
func (*XInfoGroupsCmd) String ¶
func (cmd *XInfoGroupsCmd) String() string
func (*XInfoGroupsCmd) Val ¶
func (cmd *XInfoGroupsCmd) Val() []XInfoGroup
type XInfoStream ¶
type XInfoStreamCmd ¶
type XInfoStreamCmd struct {
// contains filtered or unexported fields
}
func NewXInfoStreamCmd ¶
func NewXInfoStreamCmd(ctx context.Context, stream string) *XInfoStreamCmd
func (*XInfoStreamCmd) Result ¶
func (cmd *XInfoStreamCmd) Result() (*XInfoStream, error)
func (*XInfoStreamCmd) String ¶
func (cmd *XInfoStreamCmd) String() string
func (*XInfoStreamCmd) Val ¶
func (cmd *XInfoStreamCmd) Val() *XInfoStream
type XInfoStreamConsumer ¶
type XInfoStreamConsumer struct {
Name string
SeenTime time.Time
PelCount int64
Pending []XInfoStreamConsumerPending
}
type XInfoStreamFull ¶
type XInfoStreamFullCmd ¶
type XInfoStreamFullCmd struct {
// contains filtered or unexported fields
}
func NewXInfoStreamFullCmd ¶
func NewXInfoStreamFullCmd(ctx context.Context, args ...interface{}) *XInfoStreamFullCmd
func (*XInfoStreamFullCmd) Result ¶
func (cmd *XInfoStreamFullCmd) Result() (*XInfoStreamFull, error)
func (*XInfoStreamFullCmd) String ¶
func (cmd *XInfoStreamFullCmd) String() string
func (*XInfoStreamFullCmd) Val ¶
func (cmd *XInfoStreamFullCmd) Val() *XInfoStreamFull
type XInfoStreamGroup ¶
type XInfoStreamGroup struct {
Name string
LastDeliveredID string
PelCount int64
Pending []XInfoStreamGroupPending
Consumers []XInfoStreamConsumer
}
type XInfoStreamGroupPending ¶
type XMessageSliceCmd ¶
type XMessageSliceCmd struct {
// contains filtered or unexported fields
}
func NewXMessageSliceCmd ¶
func NewXMessageSliceCmd(ctx context.Context, args ...interface{}) *XMessageSliceCmd
func NewXMessageSliceCmdResult ¶
func NewXMessageSliceCmdResult(val []XMessage, err error) *XMessageSliceCmd
NewXMessageSliceCmdResult returns a XMessageSliceCmd initialised with val and err for testing.
func (*XMessageSliceCmd) Result ¶
func (cmd *XMessageSliceCmd) Result() ([]XMessage, error)
func (*XMessageSliceCmd) String ¶
func (cmd *XMessageSliceCmd) String() string
func (*XMessageSliceCmd) Val ¶
func (cmd *XMessageSliceCmd) Val() []XMessage
type XPendingCmd ¶
type XPendingCmd struct {
// contains filtered or unexported fields
}
func NewXPendingCmd ¶
func NewXPendingCmd(ctx context.Context, args ...interface{}) *XPendingCmd
func (*XPendingCmd) Result ¶
func (cmd *XPendingCmd) Result() (*XPending, error)
func (*XPendingCmd) String ¶
func (cmd *XPendingCmd) String() string
func (*XPendingCmd) Val ¶
func (cmd *XPendingCmd) Val() *XPending
type XPendingExt ¶
type XPendingExtArgs ¶
type XPendingExtCmd ¶
type XPendingExtCmd struct {
// contains filtered or unexported fields
}
func NewXPendingExtCmd ¶
func NewXPendingExtCmd(ctx context.Context, args ...interface{}) *XPendingExtCmd
func (*XPendingExtCmd) Result ¶
func (cmd *XPendingExtCmd) Result() ([]XPendingExt, error)
func (*XPendingExtCmd) String ¶
func (cmd *XPendingExtCmd) String() string
func (*XPendingExtCmd) Val ¶
func (cmd *XPendingExtCmd) Val() []XPendingExt
type XReadGroupArgs ¶
type XStreamSliceCmd ¶
type XStreamSliceCmd struct {
// contains filtered or unexported fields
}
func NewXStreamSliceCmd ¶
func NewXStreamSliceCmd(ctx context.Context, args ...interface{}) *XStreamSliceCmd
func NewXStreamSliceCmdResult ¶
func NewXStreamSliceCmdResult(val []XStream, err error) *XStreamSliceCmd
NewXStreamSliceCmdResult returns a XStreamSliceCmd initialised with val and err for testing.
func (*XStreamSliceCmd) Result ¶
func (cmd *XStreamSliceCmd) Result() ([]XStream, error)
func (*XStreamSliceCmd) String ¶
func (cmd *XStreamSliceCmd) String() string
func (*XStreamSliceCmd) Val ¶
func (cmd *XStreamSliceCmd) Val() []XStream
type ZRangeArgs ¶
type ZRangeArgs struct {
Key string
// When the ByScore option is provided, the open interval(exclusive) can be set.
// By default, the score intervals specified by <Start> and <Stop> are closed (inclusive).
// It is similar to the deprecated(6.2.0+) ZRangeByScore command.
// For example:
// ZRangeArgs{
// Key: "example-key",
// Start: "(3",
// Stop: 8,
// ByScore: true,
// }
// cmd: "ZRange example-key (3 8 ByScore" (3 < score <= 8).
//
// For the ByLex option, it is similar to the deprecated(6.2.0+) ZRangeByLex command.
// You can set the <Start> and <Stop> options as follows:
// ZRangeArgs{
// Key: "example-key",
// Start: "[abc",
// Stop: "(def",
// ByLex: true,
// }
// cmd: "ZRange example-key [abc (def ByLex"
//
// For normal cases (ByScore==false && ByLex==false), <Start> and <Stop> should be set to the index range (int).
// You can read the documentation for more information: https://redis.io/commands/zrange
Start interface{}
Stop interface{}
// The ByScore and ByLex options are mutually exclusive.
ByScore bool
ByLex bool
Rev bool
// limit offset count.
Offset int64
Count int64
}
ZRangeArgs is all the options of the ZRange command. In version> 6.2.0, you can replace the(cmd):
ZREVRANGE, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZRANGEBYLEX, ZREVRANGEBYLEX.
Please pay attention to your redis-server version.
Rev, ByScore, ByLex and Offset+Count options require redis-server 6.2.0 and higher.
type ZSliceCmd ¶
type ZSliceCmd struct {
// contains filtered or unexported fields
}
func NewZSliceCmd ¶
func NewZSliceCmdResult ¶
NewZSliceCmdResult returns a ZSliceCmd initialised with val and err for testing.
type ZWithKey ¶
ZWithKey represents sorted set member including the name of the key where it was popped.
type ZWithKeyCmd ¶
type ZWithKeyCmd struct {
// contains filtered or unexported fields
}
func NewZWithKeyCmd ¶
func NewZWithKeyCmd(ctx context.Context, args ...interface{}) *ZWithKeyCmd
func NewZWithKeyCmdResult ¶
func NewZWithKeyCmdResult(val *ZWithKey, err error) *ZWithKeyCmd
NewZWithKeyCmdResult returns a NewZWithKeyCmd initialised with val and err for testing.
func (*ZWithKeyCmd) Result ¶
func (cmd *ZWithKeyCmd) Result() (*ZWithKey, error)
func (*ZWithKeyCmd) String ¶
func (cmd *ZWithKeyCmd) String() string
func (*ZWithKeyCmd) Val ¶
func (cmd *ZWithKeyCmd) Val() *ZWithKey
