Documentation ¶
Overview ¶
Package redis implements a Redis client.
Example (CustomCommand) ¶
Get := func(rdb *redis.Client, key string) *redis.StringCmd { cmd := redis.NewStringCmd("get", key) rdb.Process(cmd) return cmd } v, err := Get(rdb, "key_does_not_exist").Result() fmt.Printf("%q %s", v, err)
Output: "" redis: nil
Example (CustomCommand2) ¶
v, err := rdb.Do("get", "key_does_not_exist").String() fmt.Printf("%q %s", v, err)
Output: "" redis: nil
Example (Instrumentation) ¶
rdb := redis.NewClient(&redis.Options{ Addr: ":6379", }) rdb.AddHook(redisHook{}) rdb.Ping()
Output: starting processing: <ping: > finished processing: <ping: PONG>
Index ¶
- Constants
- Variables
- func SetLogger(logger *log.Logger)
- type BitCount
- type BoolCmd
- type BoolSliceCmd
- type Client
- func (hs *Client) AddHook(hook Hook)
- func (c Client) Append(key, value string) *IntCmd
- func (c Client) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Client) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Client) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd
- func (c Client) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Client) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Client) BgRewriteAOF() *StatusCmd
- func (c Client) BgSave() *StatusCmd
- func (c Client) BitCount(key string, bitCount *BitCount) *IntCmd
- func (c Client) BitField(key string, args ...interface{}) *IntSliceCmd
- func (c Client) BitOpAnd(destKey string, keys ...string) *IntCmd
- func (c Client) BitOpNot(destKey string, key string) *IntCmd
- func (c Client) BitOpOr(destKey string, keys ...string) *IntCmd
- func (c Client) BitOpXor(destKey string, keys ...string) *IntCmd
- func (c Client) BitPos(key string, bit int64, pos ...int64) *IntCmd
- func (c Client) ClientGetName() *StringCmd
- func (c Client) ClientID() *IntCmd
- func (c Client) ClientKill(ipPort string) *StatusCmd
- func (c Client) ClientKillByFilter(keys ...string) *IntCmd
- func (c Client) ClientList() *StringCmd
- func (c Client) ClientPause(dur time.Duration) *BoolCmd
- func (c Client) ClientUnblock(id int64) *IntCmd
- func (c Client) ClientUnblockWithError(id int64) *IntCmd
- func (hs Client) Clone() hooks
- func (c *Client) Close() error
- func (c Client) ClusterAddSlots(slots ...int) *StatusCmd
- func (c Client) ClusterAddSlotsRange(min, max int) *StatusCmd
- func (c Client) ClusterCountFailureReports(nodeID string) *IntCmd
- func (c Client) ClusterCountKeysInSlot(slot int) *IntCmd
- func (c Client) ClusterDelSlots(slots ...int) *StatusCmd
- func (c Client) ClusterDelSlotsRange(min, max int) *StatusCmd
- func (c Client) ClusterFailover() *StatusCmd
- func (c Client) ClusterForget(nodeID string) *StatusCmd
- func (c Client) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
- func (c Client) ClusterInfo() *StringCmd
- func (c Client) ClusterKeySlot(key string) *IntCmd
- func (c Client) ClusterMeet(host, port string) *StatusCmd
- func (c Client) ClusterNodes() *StringCmd
- func (c Client) ClusterReplicate(nodeID string) *StatusCmd
- func (c Client) ClusterResetHard() *StatusCmd
- func (c Client) ClusterResetSoft() *StatusCmd
- func (c Client) ClusterSaveConfig() *StatusCmd
- func (c Client) ClusterSlaves(nodeID string) *StringSliceCmd
- func (c Client) ClusterSlots() *ClusterSlotsCmd
- func (c Client) Command() *CommandsInfoCmd
- func (c Client) ConfigGet(parameter string) *SliceCmd
- func (c Client) ConfigResetStat() *StatusCmd
- func (c Client) ConfigRewrite() *StatusCmd
- func (c Client) ConfigSet(parameter, value string) *StatusCmd
- func (c *Client) Conn() *Conn
- func (c *Client) Context() context.Context
- func (c Client) DBSize() *IntCmd
- func (c Client) DbSize() *IntCmd
- func (c Client) DebugObject(key string) *StringCmd
- func (c Client) Decr(key string) *IntCmd
- func (c Client) DecrBy(key string, decrement int64) *IntCmd
- func (c Client) Del(keys ...string) *IntCmd
- func (c *Client) Do(args ...interface{}) *Cmd
- func (c *Client) DoContext(ctx context.Context, args ...interface{}) *Cmd
- func (c Client) Dump(key string) *StringCmd
- func (c Client) Echo(message interface{}) *StringCmd
- func (c Client) Eval(script string, keys []string, args ...interface{}) *Cmd
- func (c Client) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd
- func (c Client) Exists(keys ...string) *IntCmd
- func (c Client) Expire(key string, expiration time.Duration) *BoolCmd
- func (c Client) ExpireAt(key string, tm time.Time) *BoolCmd
- func (c Client) FlushAll() *StatusCmd
- func (c Client) FlushAllAsync() *StatusCmd
- func (c Client) FlushDB() *StatusCmd
- func (c Client) FlushDBAsync() *StatusCmd
- func (c Client) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Client) GeoDist(key string, member1, member2, unit string) *FloatCmd
- func (c Client) GeoHash(key string, members ...string) *StringSliceCmd
- func (c Client) GeoPos(key string, members ...string) *GeoPosCmd
- func (c Client) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Client) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Client) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Client) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
- func (c Client) Get(key string) *StringCmd
- func (c Client) GetBit(key string, offset int64) *IntCmd
- func (c Client) GetRange(key string, start, end int64) *StringCmd
- func (c Client) GetSet(key string, value interface{}) *StringCmd
- func (c Client) HDel(key string, fields ...string) *IntCmd
- func (c Client) HExists(key, field string) *BoolCmd
- func (c Client) HGet(key, field string) *StringCmd
- func (c Client) HGetAll(key string) *StringStringMapCmd
- func (c Client) HIncrBy(key, field string, incr int64) *IntCmd
- func (c Client) HIncrByFloat(key, field string, incr float64) *FloatCmd
- func (c Client) HKeys(key string) *StringSliceCmd
- func (c Client) HLen(key string) *IntCmd
- func (c Client) HMGet(key string, fields ...string) *SliceCmd
- func (c Client) HMSet(key string, values ...interface{}) *IntCmd
- func (c Client) HScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Client) HSet(key, field string, value interface{}) *BoolCmd
- func (c Client) HSetNX(key, field string, value interface{}) *BoolCmd
- func (c Client) HVals(key string) *StringSliceCmd
- func (c Client) Incr(key string) *IntCmd
- func (c Client) IncrBy(key string, value int64) *IntCmd
- func (c Client) IncrByFloat(key string, value float64) *FloatCmd
- func (c Client) Info(section ...string) *StringCmd
- func (c Client) Keys(pattern string) *StringSliceCmd
- func (c Client) LIndex(key string, index int64) *StringCmd
- func (c Client) LInsert(key, op string, pivot, value interface{}) *IntCmd
- func (c Client) LInsertAfter(key string, pivot, value interface{}) *IntCmd
- func (c Client) LInsertBefore(key string, pivot, value interface{}) *IntCmd
- func (c Client) LLen(key string) *IntCmd
- func (c Client) LPop(key string) *StringCmd
- func (c Client) LPush(key string, values ...interface{}) *IntCmd
- func (c Client) LPushX(key string, values ...interface{}) *IntCmd
- func (c Client) LRange(key string, start, stop int64) *StringSliceCmd
- func (c Client) LRem(key string, count int64, value interface{}) *IntCmd
- func (c Client) LSet(key string, index int64, value interface{}) *StatusCmd
- func (c Client) LTrim(key string, start, stop int64) *StatusCmd
- func (c Client) LastSave() *IntCmd
- func (hs *Client) Lock()
- func (c Client) MGet(keys ...string) *SliceCmd
- func (c Client) MSet(values ...interface{}) *StatusCmd
- func (c Client) MSetNX(values ...interface{}) *BoolCmd
- func (c Client) MemoryUsage(key string, samples ...int) *IntCmd
- func (c Client) Migrate(host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Client) Move(key string, db int) *BoolCmd
- func (c Client) ObjectEncoding(key string) *StringCmd
- func (c Client) ObjectIdleTime(key string) *DurationCmd
- func (c Client) ObjectRefCount(key string) *IntCmd
- func (c *Client) Options() *Options
- func (c Client) PExpire(key string, expiration time.Duration) *BoolCmd
- func (c Client) PExpireAt(key string, tm time.Time) *BoolCmd
- func (c Client) PFAdd(key string, els ...interface{}) *IntCmd
- func (c Client) PFCount(keys ...string) *IntCmd
- func (c Client) PFMerge(dest string, keys ...string) *StatusCmd
- func (c *Client) PSubscribe(channels ...string) *PubSub
- func (c Client) PTTL(key string) *DurationCmd
- func (c Client) Persist(key string) *BoolCmd
- func (c Client) Ping() *StatusCmd
- func (c *Client) Pipeline() Pipeliner
- func (c *Client) Pipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Client) PoolStats() *PoolStats
- func (c *Client) Process(cmd Cmder) error
- func (c *Client) ProcessContext(ctx context.Context, cmd Cmder) error
- func (c Client) PubSubChannels(pattern string) *StringSliceCmd
- func (c Client) PubSubNumPat() *IntCmd
- func (c Client) PubSubNumSub(channels ...string) *StringIntMapCmd
- func (c Client) Publish(channel string, message interface{}) *IntCmd
- func (c Client) Quit() *StatusCmd
- func (c Client) RPop(key string) *StringCmd
- func (c Client) RPopLPush(source, destination string) *StringCmd
- func (c Client) RPush(key string, values ...interface{}) *IntCmd
- func (c Client) RPushX(key string, values ...interface{}) *IntCmd
- func (c Client) RandomKey() *StringCmd
- func (c Client) ReadOnly() *StatusCmd
- func (c Client) ReadWrite() *StatusCmd
- func (c Client) Rename(key, newkey string) *StatusCmd
- func (c Client) RenameNX(key, newkey string) *BoolCmd
- func (c Client) Restore(key string, ttl time.Duration, value string) *StatusCmd
- func (c Client) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd
- func (c Client) SAdd(key string, members ...interface{}) *IntCmd
- func (c Client) SCard(key string) *IntCmd
- func (c Client) SDiff(keys ...string) *StringSliceCmd
- func (c Client) SDiffStore(destination string, keys ...string) *IntCmd
- func (c Client) SInter(keys ...string) *StringSliceCmd
- func (c Client) SInterStore(destination string, keys ...string) *IntCmd
- func (c Client) SIsMember(key string, member interface{}) *BoolCmd
- func (c Client) SMembers(key string) *StringSliceCmd
- func (c Client) SMembersMap(key string) *StringStructMapCmd
- func (c Client) SMove(source, destination string, member interface{}) *BoolCmd
- func (c Client) SPop(key string) *StringCmd
- func (c Client) SPopN(key string, count int64) *StringSliceCmd
- func (c Client) SRandMember(key string) *StringCmd
- func (c Client) SRandMemberN(key string, count int64) *StringSliceCmd
- func (c Client) SRem(key string, members ...interface{}) *IntCmd
- func (c Client) SScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Client) SUnion(keys ...string) *StringSliceCmd
- func (c Client) SUnionStore(destination string, keys ...string) *IntCmd
- func (c Client) Save() *StatusCmd
- func (c Client) Scan(cursor uint64, match string, count int64) *ScanCmd
- func (c Client) ScriptExists(hashes ...string) *BoolSliceCmd
- func (c Client) ScriptFlush() *StatusCmd
- func (c Client) ScriptKill() *StatusCmd
- func (c Client) ScriptLoad(script string) *StringCmd
- func (c Client) Set(key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Client) SetBit(key string, offset int64, value int) *IntCmd
- func (c *Client) SetLimiter(l Limiter) *Client
- func (c Client) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Client) SetRange(key string, offset int64, value string) *IntCmd
- func (c Client) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Client) Shutdown() *StatusCmd
- func (c Client) ShutdownNoSave() *StatusCmd
- func (c Client) ShutdownSave() *StatusCmd
- func (c Client) SlaveOf(host, port string) *StatusCmd
- func (c Client) SlowLog()
- func (c Client) Sort(key string, sort *Sort) *StringSliceCmd
- func (c Client) SortInterfaces(key string, sort *Sort) *SliceCmd
- func (c Client) SortStore(key, store string, sort *Sort) *IntCmd
- func (c Client) StrLen(key string) *IntCmd
- func (c *Client) String() string
- func (c *Client) Subscribe(channels ...string) *PubSub
- func (c Client) Sync()
- func (c Client) TTL(key string) *DurationCmd
- func (c Client) Time() *TimeCmd
- func (c Client) Touch(keys ...string) *IntCmd
- func (c *Client) TxPipeline() Pipeliner
- func (c *Client) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c Client) Type(key string) *StatusCmd
- func (c Client) Unlink(keys ...string) *IntCmd
- func (c Client) Wait(numSlaves int, timeout time.Duration) *IntCmd
- func (c *Client) Watch(fn func(*Tx) error, keys ...string) error
- func (c *Client) WatchContext(ctx context.Context, fn func(*Tx) error, keys ...string) error
- func (c *Client) WithContext(ctx context.Context) *Client
- func (c Client) XAck(stream, group string, ids ...string) *IntCmd
- func (c Client) XAdd(a *XAddArgs) *StringCmd
- func (c Client) XClaim(a *XClaimArgs) *XMessageSliceCmd
- func (c Client) XClaimJustID(a *XClaimArgs) *StringSliceCmd
- func (c Client) XDel(stream string, ids ...string) *IntCmd
- func (c Client) XGroupCreate(stream, group, start string) *StatusCmd
- func (c Client) XGroupCreateMkStream(stream, group, start string) *StatusCmd
- func (c Client) XGroupDelConsumer(stream, group, consumer string) *IntCmd
- func (c Client) XGroupDestroy(stream, group string) *IntCmd
- func (c Client) XGroupSetID(stream, group, start string) *StatusCmd
- func (c Client) XInfoGroups(key string) *XInfoGroupsCmd
- func (c Client) XLen(stream string) *IntCmd
- func (c Client) XPending(stream, group string) *XPendingCmd
- func (c Client) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
- func (c Client) XRange(stream, start, stop string) *XMessageSliceCmd
- func (c Client) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Client) XRead(a *XReadArgs) *XStreamSliceCmd
- func (c Client) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
- func (c Client) XReadStreams(streams ...string) *XStreamSliceCmd
- func (c Client) XRevRange(stream, start, stop string) *XMessageSliceCmd
- func (c Client) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Client) XTrim(key string, maxLen int64) *IntCmd
- func (c Client) XTrimApprox(key string, maxLen int64) *IntCmd
- func (c Client) ZAdd(key string, members ...*Z) *IntCmd
- func (c Client) ZAddCh(key string, members ...*Z) *IntCmd
- func (c Client) ZAddNX(key string, members ...*Z) *IntCmd
- func (c Client) ZAddNXCh(key string, members ...*Z) *IntCmd
- func (c Client) ZAddXX(key string, members ...*Z) *IntCmd
- func (c Client) ZAddXXCh(key string, members ...*Z) *IntCmd
- func (c Client) ZCard(key string) *IntCmd
- func (c Client) ZCount(key, min, max string) *IntCmd
- func (c Client) ZIncr(key string, member *Z) *FloatCmd
- func (c Client) ZIncrBy(key string, increment float64, member string) *FloatCmd
- func (c Client) ZIncrNX(key string, member *Z) *FloatCmd
- func (c Client) ZIncrXX(key string, member *Z) *FloatCmd
- func (c Client) ZInterStore(destination string, store *ZStore) *IntCmd
- func (c Client) ZLexCount(key, min, max string) *IntCmd
- func (c Client) ZPopMax(key string, count ...int64) *ZSliceCmd
- func (c Client) ZPopMin(key string, count ...int64) *ZSliceCmd
- func (c Client) ZRange(key string, start, stop int64) *StringSliceCmd
- func (c Client) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Client) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Client) ZRank(key, member string) *IntCmd
- func (c Client) ZRem(key string, members ...interface{}) *IntCmd
- func (c Client) ZRemRangeByLex(key, min, max string) *IntCmd
- func (c Client) ZRemRangeByRank(key string, start, stop int64) *IntCmd
- func (c Client) ZRemRangeByScore(key, min, max string) *IntCmd
- func (c Client) ZRevRange(key string, start, stop int64) *StringSliceCmd
- func (c Client) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Client) ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Client) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Client) ZRevRank(key, member string) *IntCmd
- func (c Client) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Client) ZScore(key, member string) *FloatCmd
- func (c Client) ZUnionStore(dest string, store *ZStore) *IntCmd
- type ClusterClient
- func (hs *ClusterClient) AddHook(hook Hook)
- func (c ClusterClient) Append(key, value string) *IntCmd
- func (c ClusterClient) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c ClusterClient) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c ClusterClient) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd
- func (c ClusterClient) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c ClusterClient) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c ClusterClient) BgRewriteAOF() *StatusCmd
- func (c ClusterClient) BgSave() *StatusCmd
- func (c ClusterClient) BitCount(key string, bitCount *BitCount) *IntCmd
- func (c ClusterClient) BitField(key string, args ...interface{}) *IntSliceCmd
- func (c ClusterClient) BitOpAnd(destKey string, keys ...string) *IntCmd
- func (c ClusterClient) BitOpNot(destKey string, key string) *IntCmd
- func (c ClusterClient) BitOpOr(destKey string, keys ...string) *IntCmd
- func (c ClusterClient) BitOpXor(destKey string, keys ...string) *IntCmd
- func (c ClusterClient) BitPos(key string, bit int64, pos ...int64) *IntCmd
- func (c ClusterClient) ClientGetName() *StringCmd
- func (c ClusterClient) ClientID() *IntCmd
- func (c ClusterClient) ClientKill(ipPort string) *StatusCmd
- func (c ClusterClient) ClientKillByFilter(keys ...string) *IntCmd
- func (c ClusterClient) ClientList() *StringCmd
- func (c ClusterClient) ClientPause(dur time.Duration) *BoolCmd
- func (c ClusterClient) ClientUnblock(id int64) *IntCmd
- func (c ClusterClient) ClientUnblockWithError(id int64) *IntCmd
- func (hs ClusterClient) Clone() hooks
- func (c *ClusterClient) Close() error
- func (c ClusterClient) ClusterAddSlots(slots ...int) *StatusCmd
- func (c ClusterClient) ClusterAddSlotsRange(min, max int) *StatusCmd
- func (c ClusterClient) ClusterCountFailureReports(nodeID string) *IntCmd
- func (c ClusterClient) ClusterCountKeysInSlot(slot int) *IntCmd
- func (c ClusterClient) ClusterDelSlots(slots ...int) *StatusCmd
- func (c ClusterClient) ClusterDelSlotsRange(min, max int) *StatusCmd
- func (c ClusterClient) ClusterFailover() *StatusCmd
- func (c ClusterClient) ClusterForget(nodeID string) *StatusCmd
- func (c ClusterClient) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
- func (c ClusterClient) ClusterInfo() *StringCmd
- func (c ClusterClient) ClusterKeySlot(key string) *IntCmd
- func (c ClusterClient) ClusterMeet(host, port string) *StatusCmd
- func (c ClusterClient) ClusterNodes() *StringCmd
- func (c ClusterClient) ClusterReplicate(nodeID string) *StatusCmd
- func (c ClusterClient) ClusterResetHard() *StatusCmd
- func (c ClusterClient) ClusterResetSoft() *StatusCmd
- func (c ClusterClient) ClusterSaveConfig() *StatusCmd
- func (c ClusterClient) ClusterSlaves(nodeID string) *StringSliceCmd
- func (c ClusterClient) ClusterSlots() *ClusterSlotsCmd
- func (c ClusterClient) Command() *CommandsInfoCmd
- func (c ClusterClient) ConfigGet(parameter string) *SliceCmd
- func (c ClusterClient) ConfigResetStat() *StatusCmd
- func (c ClusterClient) ConfigRewrite() *StatusCmd
- func (c ClusterClient) ConfigSet(parameter, value string) *StatusCmd
- func (c *ClusterClient) Context() context.Context
- func (c *ClusterClient) DBSize() *IntCmd
- func (c ClusterClient) DbSize() *IntCmd
- func (c ClusterClient) DebugObject(key string) *StringCmd
- func (c ClusterClient) Decr(key string) *IntCmd
- func (c ClusterClient) DecrBy(key string, decrement int64) *IntCmd
- func (c ClusterClient) Del(keys ...string) *IntCmd
- func (c *ClusterClient) Do(args ...interface{}) *Cmd
- func (c *ClusterClient) DoContext(ctx context.Context, args ...interface{}) *Cmd
- func (c ClusterClient) Dump(key string) *StringCmd
- func (c ClusterClient) Echo(message interface{}) *StringCmd
- func (c ClusterClient) Eval(script string, keys []string, args ...interface{}) *Cmd
- func (c ClusterClient) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd
- func (c ClusterClient) Exists(keys ...string) *IntCmd
- func (c ClusterClient) Expire(key string, expiration time.Duration) *BoolCmd
- func (c ClusterClient) ExpireAt(key string, tm time.Time) *BoolCmd
- func (c ClusterClient) FlushAll() *StatusCmd
- func (c ClusterClient) FlushAllAsync() *StatusCmd
- func (c ClusterClient) FlushDB() *StatusCmd
- func (c ClusterClient) FlushDBAsync() *StatusCmd
- func (c *ClusterClient) ForEachMaster(fn func(client *Client) error) error
- func (c *ClusterClient) ForEachNode(fn func(client *Client) error) error
- func (c *ClusterClient) ForEachSlave(fn func(client *Client) error) error
- func (c ClusterClient) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
- func (c ClusterClient) GeoDist(key string, member1, member2, unit string) *FloatCmd
- func (c ClusterClient) GeoHash(key string, members ...string) *StringSliceCmd
- func (c ClusterClient) GeoPos(key string, members ...string) *GeoPosCmd
- func (c ClusterClient) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
- func (c ClusterClient) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c ClusterClient) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
- func (c ClusterClient) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
- func (c ClusterClient) Get(key string) *StringCmd
- func (c ClusterClient) GetBit(key string, offset int64) *IntCmd
- func (c ClusterClient) GetRange(key string, start, end int64) *StringCmd
- func (c ClusterClient) GetSet(key string, value interface{}) *StringCmd
- func (c ClusterClient) HDel(key string, fields ...string) *IntCmd
- func (c ClusterClient) HExists(key, field string) *BoolCmd
- func (c ClusterClient) HGet(key, field string) *StringCmd
- func (c ClusterClient) HGetAll(key string) *StringStringMapCmd
- func (c ClusterClient) HIncrBy(key, field string, incr int64) *IntCmd
- func (c ClusterClient) HIncrByFloat(key, field string, incr float64) *FloatCmd
- func (c ClusterClient) HKeys(key string) *StringSliceCmd
- func (c ClusterClient) HLen(key string) *IntCmd
- func (c ClusterClient) HMGet(key string, fields ...string) *SliceCmd
- func (c ClusterClient) HMSet(key string, values ...interface{}) *IntCmd
- func (c ClusterClient) HScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) HSet(key, field string, value interface{}) *BoolCmd
- func (c ClusterClient) HSetNX(key, field string, value interface{}) *BoolCmd
- func (c ClusterClient) HVals(key string) *StringSliceCmd
- func (c ClusterClient) Incr(key string) *IntCmd
- func (c ClusterClient) IncrBy(key string, value int64) *IntCmd
- func (c ClusterClient) IncrByFloat(key string, value float64) *FloatCmd
- func (c ClusterClient) Info(section ...string) *StringCmd
- func (c ClusterClient) Keys(pattern string) *StringSliceCmd
- func (c ClusterClient) LIndex(key string, index int64) *StringCmd
- func (c ClusterClient) LInsert(key, op string, pivot, value interface{}) *IntCmd
- func (c ClusterClient) LInsertAfter(key string, pivot, value interface{}) *IntCmd
- func (c ClusterClient) LInsertBefore(key string, pivot, value interface{}) *IntCmd
- func (c ClusterClient) LLen(key string) *IntCmd
- func (c ClusterClient) LPop(key string) *StringCmd
- func (c ClusterClient) LPush(key string, values ...interface{}) *IntCmd
- func (c ClusterClient) LPushX(key string, values ...interface{}) *IntCmd
- func (c ClusterClient) LRange(key string, start, stop int64) *StringSliceCmd
- func (c ClusterClient) LRem(key string, count int64, value interface{}) *IntCmd
- func (c ClusterClient) LSet(key string, index int64, value interface{}) *StatusCmd
- func (c ClusterClient) LTrim(key string, start, stop int64) *StatusCmd
- func (c ClusterClient) LastSave() *IntCmd
- func (hs *ClusterClient) Lock()
- func (c ClusterClient) MGet(keys ...string) *SliceCmd
- func (c ClusterClient) MSet(values ...interface{}) *StatusCmd
- func (c ClusterClient) MSetNX(values ...interface{}) *BoolCmd
- func (c ClusterClient) MemoryUsage(key string, samples ...int) *IntCmd
- func (c ClusterClient) Migrate(host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c ClusterClient) Move(key string, db int) *BoolCmd
- func (c ClusterClient) ObjectEncoding(key string) *StringCmd
- func (c ClusterClient) ObjectIdleTime(key string) *DurationCmd
- func (c ClusterClient) ObjectRefCount(key string) *IntCmd
- func (c *ClusterClient) Options() *ClusterOptions
- func (c ClusterClient) PExpire(key string, expiration time.Duration) *BoolCmd
- func (c ClusterClient) PExpireAt(key string, tm time.Time) *BoolCmd
- func (c ClusterClient) PFAdd(key string, els ...interface{}) *IntCmd
- func (c ClusterClient) PFCount(keys ...string) *IntCmd
- func (c ClusterClient) PFMerge(dest string, keys ...string) *StatusCmd
- func (c *ClusterClient) PSubscribe(channels ...string) *PubSub
- func (c ClusterClient) PTTL(key string) *DurationCmd
- func (c ClusterClient) Persist(key string) *BoolCmd
- func (c ClusterClient) Ping() *StatusCmd
- func (c *ClusterClient) Pipeline() Pipeliner
- func (c *ClusterClient) Pipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c *ClusterClient) PoolStats() *PoolStats
- func (c *ClusterClient) Process(cmd Cmder) error
- func (c *ClusterClient) ProcessContext(ctx context.Context, cmd Cmder) error
- func (c ClusterClient) PubSubChannels(pattern string) *StringSliceCmd
- func (c ClusterClient) PubSubNumPat() *IntCmd
- func (c ClusterClient) PubSubNumSub(channels ...string) *StringIntMapCmd
- func (c ClusterClient) Publish(channel string, message interface{}) *IntCmd
- func (c ClusterClient) Quit() *StatusCmd
- func (c ClusterClient) RPop(key string) *StringCmd
- func (c ClusterClient) RPopLPush(source, destination string) *StringCmd
- func (c ClusterClient) RPush(key string, values ...interface{}) *IntCmd
- func (c ClusterClient) RPushX(key string, values ...interface{}) *IntCmd
- func (c ClusterClient) RandomKey() *StringCmd
- func (c ClusterClient) ReadOnly() *StatusCmd
- func (c ClusterClient) ReadWrite() *StatusCmd
- func (c *ClusterClient) ReloadState() error
- func (c ClusterClient) Rename(key, newkey string) *StatusCmd
- func (c ClusterClient) RenameNX(key, newkey string) *BoolCmd
- func (c ClusterClient) Restore(key string, ttl time.Duration, value string) *StatusCmd
- func (c ClusterClient) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd
- func (c ClusterClient) SAdd(key string, members ...interface{}) *IntCmd
- func (c ClusterClient) SCard(key string) *IntCmd
- func (c ClusterClient) SDiff(keys ...string) *StringSliceCmd
- func (c ClusterClient) SDiffStore(destination string, keys ...string) *IntCmd
- func (c ClusterClient) SInter(keys ...string) *StringSliceCmd
- func (c ClusterClient) SInterStore(destination string, keys ...string) *IntCmd
- func (c ClusterClient) SIsMember(key string, member interface{}) *BoolCmd
- func (c ClusterClient) SMembers(key string) *StringSliceCmd
- func (c ClusterClient) SMembersMap(key string) *StringStructMapCmd
- func (c ClusterClient) SMove(source, destination string, member interface{}) *BoolCmd
- func (c ClusterClient) SPop(key string) *StringCmd
- func (c ClusterClient) SPopN(key string, count int64) *StringSliceCmd
- func (c ClusterClient) SRandMember(key string) *StringCmd
- func (c ClusterClient) SRandMemberN(key string, count int64) *StringSliceCmd
- func (c ClusterClient) SRem(key string, members ...interface{}) *IntCmd
- func (c ClusterClient) SScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) SUnion(keys ...string) *StringSliceCmd
- func (c ClusterClient) SUnionStore(destination string, keys ...string) *IntCmd
- func (c ClusterClient) Save() *StatusCmd
- func (c ClusterClient) Scan(cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) ScriptExists(hashes ...string) *BoolSliceCmd
- func (c ClusterClient) ScriptFlush() *StatusCmd
- func (c ClusterClient) ScriptKill() *StatusCmd
- func (c ClusterClient) ScriptLoad(script string) *StringCmd
- func (c ClusterClient) Set(key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c ClusterClient) SetBit(key string, offset int64, value int) *IntCmd
- func (c ClusterClient) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c ClusterClient) SetRange(key string, offset int64, value string) *IntCmd
- func (c ClusterClient) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c ClusterClient) Shutdown() *StatusCmd
- func (c ClusterClient) ShutdownNoSave() *StatusCmd
- func (c ClusterClient) ShutdownSave() *StatusCmd
- func (c ClusterClient) SlaveOf(host, port string) *StatusCmd
- func (c ClusterClient) SlowLog()
- func (c ClusterClient) Sort(key string, sort *Sort) *StringSliceCmd
- func (c ClusterClient) SortInterfaces(key string, sort *Sort) *SliceCmd
- func (c ClusterClient) SortStore(key, store string, sort *Sort) *IntCmd
- func (c ClusterClient) StrLen(key string) *IntCmd
- func (c *ClusterClient) Subscribe(channels ...string) *PubSub
- func (c ClusterClient) Sync()
- func (c ClusterClient) TTL(key string) *DurationCmd
- func (c ClusterClient) Time() *TimeCmd
- func (c ClusterClient) Touch(keys ...string) *IntCmd
- func (c *ClusterClient) TxPipeline() Pipeliner
- func (c *ClusterClient) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c ClusterClient) Type(key string) *StatusCmd
- func (c ClusterClient) Unlink(keys ...string) *IntCmd
- func (c ClusterClient) Wait(numSlaves int, timeout time.Duration) *IntCmd
- func (c *ClusterClient) Watch(fn func(*Tx) error, keys ...string) error
- func (c *ClusterClient) WatchContext(ctx context.Context, fn func(*Tx) error, keys ...string) error
- func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient
- func (c ClusterClient) XAck(stream, group string, ids ...string) *IntCmd
- func (c ClusterClient) XAdd(a *XAddArgs) *StringCmd
- func (c ClusterClient) XClaim(a *XClaimArgs) *XMessageSliceCmd
- func (c ClusterClient) XClaimJustID(a *XClaimArgs) *StringSliceCmd
- func (c ClusterClient) XDel(stream string, ids ...string) *IntCmd
- func (c ClusterClient) XGroupCreate(stream, group, start string) *StatusCmd
- func (c ClusterClient) XGroupCreateMkStream(stream, group, start string) *StatusCmd
- func (c ClusterClient) XGroupDelConsumer(stream, group, consumer string) *IntCmd
- func (c ClusterClient) XGroupDestroy(stream, group string) *IntCmd
- func (c ClusterClient) XGroupSetID(stream, group, start string) *StatusCmd
- func (c ClusterClient) XInfoGroups(key string) *XInfoGroupsCmd
- func (c ClusterClient) XLen(stream string) *IntCmd
- func (c ClusterClient) XPending(stream, group string) *XPendingCmd
- func (c ClusterClient) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
- func (c ClusterClient) XRange(stream, start, stop string) *XMessageSliceCmd
- func (c ClusterClient) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c ClusterClient) XRead(a *XReadArgs) *XStreamSliceCmd
- func (c ClusterClient) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
- func (c ClusterClient) XReadStreams(streams ...string) *XStreamSliceCmd
- func (c ClusterClient) XRevRange(stream, start, stop string) *XMessageSliceCmd
- func (c ClusterClient) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c ClusterClient) XTrim(key string, maxLen int64) *IntCmd
- func (c ClusterClient) XTrimApprox(key string, maxLen int64) *IntCmd
- func (c ClusterClient) ZAdd(key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddCh(key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddNX(key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddNXCh(key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddXX(key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZAddXXCh(key string, members ...*Z) *IntCmd
- func (c ClusterClient) ZCard(key string) *IntCmd
- func (c ClusterClient) ZCount(key, min, max string) *IntCmd
- func (c ClusterClient) ZIncr(key string, member *Z) *FloatCmd
- func (c ClusterClient) ZIncrBy(key string, increment float64, member string) *FloatCmd
- func (c ClusterClient) ZIncrNX(key string, member *Z) *FloatCmd
- func (c ClusterClient) ZIncrXX(key string, member *Z) *FloatCmd
- func (c ClusterClient) ZInterStore(destination string, store *ZStore) *IntCmd
- func (c ClusterClient) ZLexCount(key, min, max string) *IntCmd
- func (c ClusterClient) ZPopMax(key string, count ...int64) *ZSliceCmd
- func (c ClusterClient) ZPopMin(key string, count ...int64) *ZSliceCmd
- func (c ClusterClient) ZRange(key string, start, stop int64) *StringSliceCmd
- func (c ClusterClient) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c ClusterClient) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c ClusterClient) ZRank(key, member string) *IntCmd
- func (c ClusterClient) ZRem(key string, members ...interface{}) *IntCmd
- func (c ClusterClient) ZRemRangeByLex(key, min, max string) *IntCmd
- func (c ClusterClient) ZRemRangeByRank(key string, start, stop int64) *IntCmd
- func (c ClusterClient) ZRemRangeByScore(key, min, max string) *IntCmd
- func (c ClusterClient) ZRevRange(key string, start, stop int64) *StringSliceCmd
- func (c ClusterClient) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c ClusterClient) ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c ClusterClient) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c ClusterClient) ZRevRank(key, member string) *IntCmd
- func (c ClusterClient) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c ClusterClient) ZScore(key, member string) *FloatCmd
- func (c ClusterClient) ZUnionStore(dest string, store *ZStore) *IntCmd
- type ClusterNode
- type ClusterOptions
- type ClusterSlot
- type ClusterSlotsCmd
- 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) Int() (int, error)
- func (cmd *Cmd) Int64() (int64, error)
- func (cmd *Cmd) Name() string
- func (cmd *Cmd) Result() (interface{}, error)
- func (cmd *Cmd) String() (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) Name() string
- func (cmd *CommandsInfoCmd) Result() (map[string]*CommandInfo, error)
- func (cmd *CommandsInfoCmd) String() string
- func (cmd *CommandsInfoCmd) Val() map[string]*CommandInfo
- type Conn
- func (c *Conn) Pipeline() Pipeliner
- func (c *Conn) Pipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Conn) Process(cmd Cmder) error
- func (c *Conn) ProcessContext(ctx context.Context, cmd Cmder) error
- func (c *Conn) TxPipeline() Pipeliner
- func (c *Conn) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error)
- type DurationCmd
- type FailoverOptions
- type FloatCmd
- type GeoLocation
- type GeoLocationCmd
- type GeoPos
- type GeoPosCmd
- type GeoRadiusQuery
- type Hash
- type Hook
- type IntCmd
- type IntSliceCmd
- type Limiter
- type Message
- type Options
- type Pipeline
- func (c Pipeline) Append(key, value string) *IntCmd
- func (c Pipeline) Auth(password string) *StatusCmd
- func (c Pipeline) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Pipeline) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Pipeline) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd
- func (c Pipeline) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Pipeline) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Pipeline) BgRewriteAOF() *StatusCmd
- func (c Pipeline) BgSave() *StatusCmd
- func (c Pipeline) BitCount(key string, bitCount *BitCount) *IntCmd
- func (c Pipeline) BitField(key string, args ...interface{}) *IntSliceCmd
- func (c Pipeline) BitOpAnd(destKey string, keys ...string) *IntCmd
- func (c Pipeline) BitOpNot(destKey string, key string) *IntCmd
- func (c Pipeline) BitOpOr(destKey string, keys ...string) *IntCmd
- func (c Pipeline) BitOpXor(destKey string, keys ...string) *IntCmd
- func (c Pipeline) BitPos(key string, bit int64, pos ...int64) *IntCmd
- func (c Pipeline) ClientGetName() *StringCmd
- func (c Pipeline) ClientID() *IntCmd
- func (c Pipeline) ClientKill(ipPort string) *StatusCmd
- func (c Pipeline) ClientKillByFilter(keys ...string) *IntCmd
- func (c Pipeline) ClientList() *StringCmd
- func (c Pipeline) ClientPause(dur time.Duration) *BoolCmd
- func (c Pipeline) ClientSetName(name string) *BoolCmd
- func (c Pipeline) ClientUnblock(id int64) *IntCmd
- func (c Pipeline) ClientUnblockWithError(id int64) *IntCmd
- func (c *Pipeline) Close() error
- func (c Pipeline) ClusterAddSlots(slots ...int) *StatusCmd
- func (c Pipeline) ClusterAddSlotsRange(min, max int) *StatusCmd
- func (c Pipeline) ClusterCountFailureReports(nodeID string) *IntCmd
- func (c Pipeline) ClusterCountKeysInSlot(slot int) *IntCmd
- func (c Pipeline) ClusterDelSlots(slots ...int) *StatusCmd
- func (c Pipeline) ClusterDelSlotsRange(min, max int) *StatusCmd
- func (c Pipeline) ClusterFailover() *StatusCmd
- func (c Pipeline) ClusterForget(nodeID string) *StatusCmd
- func (c Pipeline) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
- func (c Pipeline) ClusterInfo() *StringCmd
- func (c Pipeline) ClusterKeySlot(key string) *IntCmd
- func (c Pipeline) ClusterMeet(host, port string) *StatusCmd
- func (c Pipeline) ClusterNodes() *StringCmd
- func (c Pipeline) ClusterReplicate(nodeID string) *StatusCmd
- func (c Pipeline) ClusterResetHard() *StatusCmd
- func (c Pipeline) ClusterResetSoft() *StatusCmd
- func (c Pipeline) ClusterSaveConfig() *StatusCmd
- func (c Pipeline) ClusterSlaves(nodeID string) *StringSliceCmd
- func (c Pipeline) ClusterSlots() *ClusterSlotsCmd
- func (c Pipeline) Command() *CommandsInfoCmd
- func (c Pipeline) ConfigGet(parameter string) *SliceCmd
- func (c Pipeline) ConfigResetStat() *StatusCmd
- func (c Pipeline) ConfigRewrite() *StatusCmd
- func (c Pipeline) ConfigSet(parameter, value string) *StatusCmd
- func (c Pipeline) DBSize() *IntCmd
- func (c Pipeline) DbSize() *IntCmd
- func (c Pipeline) DebugObject(key string) *StringCmd
- func (c Pipeline) Decr(key string) *IntCmd
- func (c Pipeline) DecrBy(key string, decrement int64) *IntCmd
- func (c Pipeline) Del(keys ...string) *IntCmd
- func (c *Pipeline) Discard() error
- func (c *Pipeline) Do(args ...interface{}) *Cmd
- func (c Pipeline) Dump(key string) *StringCmd
- func (c Pipeline) Echo(message interface{}) *StringCmd
- func (c Pipeline) Eval(script string, keys []string, args ...interface{}) *Cmd
- func (c Pipeline) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd
- func (c *Pipeline) Exec() ([]Cmder, error)
- func (c *Pipeline) ExecContext(ctx context.Context) ([]Cmder, error)
- func (c Pipeline) Exists(keys ...string) *IntCmd
- func (c Pipeline) Expire(key string, expiration time.Duration) *BoolCmd
- func (c Pipeline) ExpireAt(key string, tm time.Time) *BoolCmd
- func (c Pipeline) FlushAll() *StatusCmd
- func (c Pipeline) FlushAllAsync() *StatusCmd
- func (c Pipeline) FlushDB() *StatusCmd
- func (c Pipeline) FlushDBAsync() *StatusCmd
- func (c Pipeline) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Pipeline) GeoDist(key string, member1, member2, unit string) *FloatCmd
- func (c Pipeline) GeoHash(key string, members ...string) *StringSliceCmd
- func (c Pipeline) GeoPos(key string, members ...string) *GeoPosCmd
- func (c Pipeline) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Pipeline) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Pipeline) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Pipeline) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
- func (c Pipeline) Get(key string) *StringCmd
- func (c Pipeline) GetBit(key string, offset int64) *IntCmd
- func (c Pipeline) GetRange(key string, start, end int64) *StringCmd
- func (c Pipeline) GetSet(key string, value interface{}) *StringCmd
- func (c Pipeline) HDel(key string, fields ...string) *IntCmd
- func (c Pipeline) HExists(key, field string) *BoolCmd
- func (c Pipeline) HGet(key, field string) *StringCmd
- func (c Pipeline) HGetAll(key string) *StringStringMapCmd
- func (c Pipeline) HIncrBy(key, field string, incr int64) *IntCmd
- func (c Pipeline) HIncrByFloat(key, field string, incr float64) *FloatCmd
- func (c Pipeline) HKeys(key string) *StringSliceCmd
- func (c Pipeline) HLen(key string) *IntCmd
- func (c Pipeline) HMGet(key string, fields ...string) *SliceCmd
- func (c Pipeline) HMSet(key string, values ...interface{}) *IntCmd
- func (c Pipeline) HScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) HSet(key, field string, value interface{}) *BoolCmd
- func (c Pipeline) HSetNX(key, field string, value interface{}) *BoolCmd
- func (c Pipeline) HVals(key string) *StringSliceCmd
- func (c Pipeline) Incr(key string) *IntCmd
- func (c Pipeline) IncrBy(key string, value int64) *IntCmd
- func (c Pipeline) IncrByFloat(key string, value float64) *FloatCmd
- func (c Pipeline) Info(section ...string) *StringCmd
- func (c Pipeline) Keys(pattern string) *StringSliceCmd
- func (c Pipeline) LIndex(key string, index int64) *StringCmd
- func (c Pipeline) LInsert(key, op string, pivot, value interface{}) *IntCmd
- func (c Pipeline) LInsertAfter(key string, pivot, value interface{}) *IntCmd
- func (c Pipeline) LInsertBefore(key string, pivot, value interface{}) *IntCmd
- func (c Pipeline) LLen(key string) *IntCmd
- func (c Pipeline) LPop(key string) *StringCmd
- func (c Pipeline) LPush(key string, values ...interface{}) *IntCmd
- func (c Pipeline) LPushX(key string, values ...interface{}) *IntCmd
- func (c Pipeline) LRange(key string, start, stop int64) *StringSliceCmd
- func (c Pipeline) LRem(key string, count int64, value interface{}) *IntCmd
- func (c Pipeline) LSet(key string, index int64, value interface{}) *StatusCmd
- func (c Pipeline) LTrim(key string, start, stop int64) *StatusCmd
- func (c Pipeline) LastSave() *IntCmd
- func (c Pipeline) MGet(keys ...string) *SliceCmd
- func (c Pipeline) MSet(values ...interface{}) *StatusCmd
- func (c Pipeline) MSetNX(values ...interface{}) *BoolCmd
- func (c Pipeline) MemoryUsage(key string, samples ...int) *IntCmd
- func (c Pipeline) Migrate(host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Pipeline) Move(key string, db int) *BoolCmd
- func (c Pipeline) ObjectEncoding(key string) *StringCmd
- func (c Pipeline) ObjectIdleTime(key string) *DurationCmd
- func (c Pipeline) ObjectRefCount(key string) *IntCmd
- func (c Pipeline) PExpire(key string, expiration time.Duration) *BoolCmd
- func (c Pipeline) PExpireAt(key string, tm time.Time) *BoolCmd
- func (c Pipeline) PFAdd(key string, els ...interface{}) *IntCmd
- func (c Pipeline) PFCount(keys ...string) *IntCmd
- func (c Pipeline) PFMerge(dest string, keys ...string) *StatusCmd
- func (c Pipeline) PTTL(key string) *DurationCmd
- func (c Pipeline) Persist(key string) *BoolCmd
- func (c Pipeline) Ping() *StatusCmd
- func (c *Pipeline) Pipeline() Pipeliner
- func (c *Pipeline) Pipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Pipeline) Process(cmd Cmder) error
- func (c Pipeline) PubSubChannels(pattern string) *StringSliceCmd
- func (c Pipeline) PubSubNumPat() *IntCmd
- func (c Pipeline) PubSubNumSub(channels ...string) *StringIntMapCmd
- func (c Pipeline) Publish(channel string, message interface{}) *IntCmd
- func (c Pipeline) Quit() *StatusCmd
- func (c Pipeline) RPop(key string) *StringCmd
- func (c Pipeline) RPopLPush(source, destination string) *StringCmd
- func (c Pipeline) RPush(key string, values ...interface{}) *IntCmd
- func (c Pipeline) RPushX(key string, values ...interface{}) *IntCmd
- func (c Pipeline) RandomKey() *StringCmd
- func (c Pipeline) ReadOnly() *StatusCmd
- func (c Pipeline) ReadWrite() *StatusCmd
- func (c Pipeline) Rename(key, newkey string) *StatusCmd
- func (c Pipeline) RenameNX(key, newkey string) *BoolCmd
- func (c Pipeline) Restore(key string, ttl time.Duration, value string) *StatusCmd
- func (c Pipeline) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd
- func (c Pipeline) SAdd(key string, members ...interface{}) *IntCmd
- func (c Pipeline) SCard(key string) *IntCmd
- func (c Pipeline) SDiff(keys ...string) *StringSliceCmd
- func (c Pipeline) SDiffStore(destination string, keys ...string) *IntCmd
- func (c Pipeline) SInter(keys ...string) *StringSliceCmd
- func (c Pipeline) SInterStore(destination string, keys ...string) *IntCmd
- func (c Pipeline) SIsMember(key string, member interface{}) *BoolCmd
- func (c Pipeline) SMembers(key string) *StringSliceCmd
- func (c Pipeline) SMembersMap(key string) *StringStructMapCmd
- func (c Pipeline) SMove(source, destination string, member interface{}) *BoolCmd
- func (c Pipeline) SPop(key string) *StringCmd
- func (c Pipeline) SPopN(key string, count int64) *StringSliceCmd
- func (c Pipeline) SRandMember(key string) *StringCmd
- func (c Pipeline) SRandMemberN(key string, count int64) *StringSliceCmd
- func (c Pipeline) SRem(key string, members ...interface{}) *IntCmd
- func (c Pipeline) SScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) SUnion(keys ...string) *StringSliceCmd
- func (c Pipeline) SUnionStore(destination string, keys ...string) *IntCmd
- func (c Pipeline) Save() *StatusCmd
- func (c Pipeline) Scan(cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) ScriptExists(hashes ...string) *BoolSliceCmd
- func (c Pipeline) ScriptFlush() *StatusCmd
- func (c Pipeline) ScriptKill() *StatusCmd
- func (c Pipeline) ScriptLoad(script string) *StringCmd
- func (c Pipeline) Select(index int) *StatusCmd
- func (c Pipeline) Set(key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Pipeline) SetBit(key string, offset int64, value int) *IntCmd
- func (c Pipeline) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Pipeline) SetRange(key string, offset int64, value string) *IntCmd
- func (c Pipeline) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Pipeline) Shutdown() *StatusCmd
- func (c Pipeline) ShutdownNoSave() *StatusCmd
- func (c Pipeline) ShutdownSave() *StatusCmd
- func (c Pipeline) SlaveOf(host, port string) *StatusCmd
- func (c Pipeline) SlowLog()
- func (c Pipeline) Sort(key string, sort *Sort) *StringSliceCmd
- func (c Pipeline) SortInterfaces(key string, sort *Sort) *SliceCmd
- func (c Pipeline) SortStore(key, store string, sort *Sort) *IntCmd
- func (c Pipeline) StrLen(key string) *IntCmd
- func (c Pipeline) SwapDB(index1, index2 int) *StatusCmd
- func (c Pipeline) Sync()
- func (c Pipeline) TTL(key string) *DurationCmd
- func (c Pipeline) Time() *TimeCmd
- func (c Pipeline) Touch(keys ...string) *IntCmd
- func (c *Pipeline) TxPipeline() Pipeliner
- func (c *Pipeline) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c Pipeline) Type(key string) *StatusCmd
- func (c Pipeline) Unlink(keys ...string) *IntCmd
- func (c Pipeline) Wait(numSlaves int, timeout time.Duration) *IntCmd
- func (c Pipeline) XAck(stream, group string, ids ...string) *IntCmd
- func (c Pipeline) XAdd(a *XAddArgs) *StringCmd
- func (c Pipeline) XClaim(a *XClaimArgs) *XMessageSliceCmd
- func (c Pipeline) XClaimJustID(a *XClaimArgs) *StringSliceCmd
- func (c Pipeline) XDel(stream string, ids ...string) *IntCmd
- func (c Pipeline) XGroupCreate(stream, group, start string) *StatusCmd
- func (c Pipeline) XGroupCreateMkStream(stream, group, start string) *StatusCmd
- func (c Pipeline) XGroupDelConsumer(stream, group, consumer string) *IntCmd
- func (c Pipeline) XGroupDestroy(stream, group string) *IntCmd
- func (c Pipeline) XGroupSetID(stream, group, start string) *StatusCmd
- func (c Pipeline) XInfoGroups(key string) *XInfoGroupsCmd
- func (c Pipeline) XLen(stream string) *IntCmd
- func (c Pipeline) XPending(stream, group string) *XPendingCmd
- func (c Pipeline) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
- func (c Pipeline) XRange(stream, start, stop string) *XMessageSliceCmd
- func (c Pipeline) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Pipeline) XRead(a *XReadArgs) *XStreamSliceCmd
- func (c Pipeline) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
- func (c Pipeline) XReadStreams(streams ...string) *XStreamSliceCmd
- func (c Pipeline) XRevRange(stream, start, stop string) *XMessageSliceCmd
- func (c Pipeline) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Pipeline) XTrim(key string, maxLen int64) *IntCmd
- func (c Pipeline) XTrimApprox(key string, maxLen int64) *IntCmd
- func (c Pipeline) ZAdd(key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddCh(key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddNX(key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddNXCh(key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddXX(key string, members ...*Z) *IntCmd
- func (c Pipeline) ZAddXXCh(key string, members ...*Z) *IntCmd
- func (c Pipeline) ZCard(key string) *IntCmd
- func (c Pipeline) ZCount(key, min, max string) *IntCmd
- func (c Pipeline) ZIncr(key string, member *Z) *FloatCmd
- func (c Pipeline) ZIncrBy(key string, increment float64, member string) *FloatCmd
- func (c Pipeline) ZIncrNX(key string, member *Z) *FloatCmd
- func (c Pipeline) ZIncrXX(key string, member *Z) *FloatCmd
- func (c Pipeline) ZInterStore(destination string, store *ZStore) *IntCmd
- func (c Pipeline) ZLexCount(key, min, max string) *IntCmd
- func (c Pipeline) ZPopMax(key string, count ...int64) *ZSliceCmd
- func (c Pipeline) ZPopMin(key string, count ...int64) *ZSliceCmd
- func (c Pipeline) ZRange(key string, start, stop int64) *StringSliceCmd
- func (c Pipeline) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Pipeline) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Pipeline) ZRank(key, member string) *IntCmd
- func (c Pipeline) ZRem(key string, members ...interface{}) *IntCmd
- func (c Pipeline) ZRemRangeByLex(key, min, max string) *IntCmd
- func (c Pipeline) ZRemRangeByRank(key string, start, stop int64) *IntCmd
- func (c Pipeline) ZRemRangeByScore(key, min, max string) *IntCmd
- func (c Pipeline) ZRevRange(key string, start, stop int64) *StringSliceCmd
- func (c Pipeline) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Pipeline) ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Pipeline) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Pipeline) ZRevRank(key, member string) *IntCmd
- func (c Pipeline) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Pipeline) ZScore(key, member string) *FloatCmd
- func (c Pipeline) ZUnionStore(dest string, store *ZStore) *IntCmd
- type Pipeliner
- type Pong
- type PoolStats
- type PubSub
- func (c *PubSub) Channel() <-chan *Message
- func (c *PubSub) ChannelSize(size int) <-chan *Message
- func (c *PubSub) ChannelWithSubscriptions(size int) <-chan interface{}
- func (c *PubSub) Close() error
- func (c *PubSub) PSubscribe(patterns ...string) error
- func (c *PubSub) PUnsubscribe(patterns ...string) error
- func (c *PubSub) Ping(payload ...string) error
- func (c *PubSub) Receive() (interface{}, error)
- func (c *PubSub) ReceiveMessage() (*Message, error)
- func (c *PubSub) ReceiveTimeout(timeout time.Duration) (interface{}, error)
- func (c *PubSub) String() string
- func (c *PubSub) Subscribe(channels ...string) error
- func (c *PubSub) Unsubscribe(channels ...string) error
- type Ring
- func (hs *Ring) AddHook(hook Hook)
- func (c Ring) Append(key, value string) *IntCmd
- func (c Ring) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Ring) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Ring) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd
- func (c Ring) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Ring) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Ring) BgRewriteAOF() *StatusCmd
- func (c Ring) BgSave() *StatusCmd
- func (c Ring) BitCount(key string, bitCount *BitCount) *IntCmd
- func (c Ring) BitField(key string, args ...interface{}) *IntSliceCmd
- func (c Ring) BitOpAnd(destKey string, keys ...string) *IntCmd
- func (c Ring) BitOpNot(destKey string, key string) *IntCmd
- func (c Ring) BitOpOr(destKey string, keys ...string) *IntCmd
- func (c Ring) BitOpXor(destKey string, keys ...string) *IntCmd
- func (c Ring) BitPos(key string, bit int64, pos ...int64) *IntCmd
- func (c Ring) ClientGetName() *StringCmd
- func (c Ring) ClientID() *IntCmd
- func (c Ring) ClientKill(ipPort string) *StatusCmd
- func (c Ring) ClientKillByFilter(keys ...string) *IntCmd
- func (c Ring) ClientList() *StringCmd
- func (c Ring) ClientPause(dur time.Duration) *BoolCmd
- func (c Ring) ClientUnblock(id int64) *IntCmd
- func (c Ring) ClientUnblockWithError(id int64) *IntCmd
- func (hs Ring) Clone() hooks
- func (c *Ring) Close() error
- func (c Ring) ClusterAddSlots(slots ...int) *StatusCmd
- func (c Ring) ClusterAddSlotsRange(min, max int) *StatusCmd
- func (c Ring) ClusterCountFailureReports(nodeID string) *IntCmd
- func (c Ring) ClusterCountKeysInSlot(slot int) *IntCmd
- func (c Ring) ClusterDelSlots(slots ...int) *StatusCmd
- func (c Ring) ClusterDelSlotsRange(min, max int) *StatusCmd
- func (c Ring) ClusterFailover() *StatusCmd
- func (c Ring) ClusterForget(nodeID string) *StatusCmd
- func (c Ring) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
- func (c Ring) ClusterInfo() *StringCmd
- func (c Ring) ClusterKeySlot(key string) *IntCmd
- func (c Ring) ClusterMeet(host, port string) *StatusCmd
- func (c Ring) ClusterNodes() *StringCmd
- func (c Ring) ClusterReplicate(nodeID string) *StatusCmd
- func (c Ring) ClusterResetHard() *StatusCmd
- func (c Ring) ClusterResetSoft() *StatusCmd
- func (c Ring) ClusterSaveConfig() *StatusCmd
- func (c Ring) ClusterSlaves(nodeID string) *StringSliceCmd
- func (c Ring) ClusterSlots() *ClusterSlotsCmd
- func (c Ring) Command() *CommandsInfoCmd
- func (c Ring) ConfigGet(parameter string) *SliceCmd
- func (c Ring) ConfigResetStat() *StatusCmd
- func (c Ring) ConfigRewrite() *StatusCmd
- func (c Ring) ConfigSet(parameter, value string) *StatusCmd
- func (c *Ring) Context() context.Context
- func (c Ring) DBSize() *IntCmd
- func (c Ring) DbSize() *IntCmd
- func (c Ring) DebugObject(key string) *StringCmd
- func (c Ring) Decr(key string) *IntCmd
- func (c Ring) DecrBy(key string, decrement int64) *IntCmd
- func (c Ring) Del(keys ...string) *IntCmd
- func (c *Ring) Do(args ...interface{}) *Cmd
- func (c *Ring) DoContext(ctx context.Context, args ...interface{}) *Cmd
- func (c Ring) Dump(key string) *StringCmd
- func (c Ring) Echo(message interface{}) *StringCmd
- func (c Ring) Eval(script string, keys []string, args ...interface{}) *Cmd
- func (c Ring) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd
- func (c Ring) Exists(keys ...string) *IntCmd
- func (c Ring) Expire(key string, expiration time.Duration) *BoolCmd
- func (c Ring) ExpireAt(key string, tm time.Time) *BoolCmd
- func (c Ring) FlushAll() *StatusCmd
- func (c Ring) FlushAllAsync() *StatusCmd
- func (c Ring) FlushDB() *StatusCmd
- func (c Ring) FlushDBAsync() *StatusCmd
- func (c *Ring) ForEachShard(fn func(client *Client) error) error
- func (c Ring) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Ring) GeoDist(key string, member1, member2, unit string) *FloatCmd
- func (c Ring) GeoHash(key string, members ...string) *StringSliceCmd
- func (c Ring) GeoPos(key string, members ...string) *GeoPosCmd
- func (c Ring) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Ring) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Ring) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Ring) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
- func (c Ring) Get(key string) *StringCmd
- func (c Ring) GetBit(key string, offset int64) *IntCmd
- func (c Ring) GetRange(key string, start, end int64) *StringCmd
- func (c Ring) GetSet(key string, value interface{}) *StringCmd
- func (c Ring) HDel(key string, fields ...string) *IntCmd
- func (c Ring) HExists(key, field string) *BoolCmd
- func (c Ring) HGet(key, field string) *StringCmd
- func (c Ring) HGetAll(key string) *StringStringMapCmd
- func (c Ring) HIncrBy(key, field string, incr int64) *IntCmd
- func (c Ring) HIncrByFloat(key, field string, incr float64) *FloatCmd
- func (c Ring) HKeys(key string) *StringSliceCmd
- func (c Ring) HLen(key string) *IntCmd
- func (c Ring) HMGet(key string, fields ...string) *SliceCmd
- func (c Ring) HMSet(key string, values ...interface{}) *IntCmd
- func (c Ring) HScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) HSet(key, field string, value interface{}) *BoolCmd
- func (c Ring) HSetNX(key, field string, value interface{}) *BoolCmd
- func (c Ring) HVals(key string) *StringSliceCmd
- func (c Ring) Incr(key string) *IntCmd
- func (c Ring) IncrBy(key string, value int64) *IntCmd
- func (c Ring) IncrByFloat(key string, value float64) *FloatCmd
- func (c Ring) Info(section ...string) *StringCmd
- func (c Ring) Keys(pattern string) *StringSliceCmd
- func (c Ring) LIndex(key string, index int64) *StringCmd
- func (c Ring) LInsert(key, op string, pivot, value interface{}) *IntCmd
- func (c Ring) LInsertAfter(key string, pivot, value interface{}) *IntCmd
- func (c Ring) LInsertBefore(key string, pivot, value interface{}) *IntCmd
- func (c Ring) LLen(key string) *IntCmd
- func (c Ring) LPop(key string) *StringCmd
- func (c Ring) LPush(key string, values ...interface{}) *IntCmd
- func (c Ring) LPushX(key string, values ...interface{}) *IntCmd
- func (c Ring) LRange(key string, start, stop int64) *StringSliceCmd
- func (c Ring) LRem(key string, count int64, value interface{}) *IntCmd
- func (c Ring) LSet(key string, index int64, value interface{}) *StatusCmd
- func (c Ring) LTrim(key string, start, stop int64) *StatusCmd
- func (c Ring) LastSave() *IntCmd
- func (c *Ring) Len() int
- func (hs *Ring) Lock()
- func (c Ring) MGet(keys ...string) *SliceCmd
- func (c Ring) MSet(values ...interface{}) *StatusCmd
- func (c Ring) MSetNX(values ...interface{}) *BoolCmd
- func (c Ring) MemoryUsage(key string, samples ...int) *IntCmd
- func (c Ring) Migrate(host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Ring) Move(key string, db int) *BoolCmd
- func (c Ring) ObjectEncoding(key string) *StringCmd
- func (c Ring) ObjectIdleTime(key string) *DurationCmd
- func (c Ring) ObjectRefCount(key string) *IntCmd
- func (c *Ring) Options() *RingOptions
- func (c Ring) PExpire(key string, expiration time.Duration) *BoolCmd
- func (c Ring) PExpireAt(key string, tm time.Time) *BoolCmd
- func (c Ring) PFAdd(key string, els ...interface{}) *IntCmd
- func (c Ring) PFCount(keys ...string) *IntCmd
- func (c Ring) PFMerge(dest string, keys ...string) *StatusCmd
- func (c *Ring) PSubscribe(channels ...string) *PubSub
- func (c Ring) PTTL(key string) *DurationCmd
- func (c Ring) Persist(key string) *BoolCmd
- func (c Ring) Ping() *StatusCmd
- func (c *Ring) Pipeline() Pipeliner
- func (c *Ring) Pipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Ring) PoolStats() *PoolStats
- func (c *Ring) Process(cmd Cmder) error
- func (c *Ring) ProcessContext(ctx context.Context, cmd Cmder) error
- func (c Ring) PubSubChannels(pattern string) *StringSliceCmd
- func (c Ring) PubSubNumPat() *IntCmd
- func (c Ring) PubSubNumSub(channels ...string) *StringIntMapCmd
- func (c Ring) Publish(channel string, message interface{}) *IntCmd
- func (c Ring) Quit() *StatusCmd
- func (c Ring) RPop(key string) *StringCmd
- func (c Ring) RPopLPush(source, destination string) *StringCmd
- func (c Ring) RPush(key string, values ...interface{}) *IntCmd
- func (c Ring) RPushX(key string, values ...interface{}) *IntCmd
- func (c Ring) RandomKey() *StringCmd
- func (c Ring) ReadOnly() *StatusCmd
- func (c Ring) ReadWrite() *StatusCmd
- func (c Ring) Rename(key, newkey string) *StatusCmd
- func (c Ring) RenameNX(key, newkey string) *BoolCmd
- func (c Ring) Restore(key string, ttl time.Duration, value string) *StatusCmd
- func (c Ring) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd
- func (c Ring) SAdd(key string, members ...interface{}) *IntCmd
- func (c Ring) SCard(key string) *IntCmd
- func (c Ring) SDiff(keys ...string) *StringSliceCmd
- func (c Ring) SDiffStore(destination string, keys ...string) *IntCmd
- func (c Ring) SInter(keys ...string) *StringSliceCmd
- func (c Ring) SInterStore(destination string, keys ...string) *IntCmd
- func (c Ring) SIsMember(key string, member interface{}) *BoolCmd
- func (c Ring) SMembers(key string) *StringSliceCmd
- func (c Ring) SMembersMap(key string) *StringStructMapCmd
- func (c Ring) SMove(source, destination string, member interface{}) *BoolCmd
- func (c Ring) SPop(key string) *StringCmd
- func (c Ring) SPopN(key string, count int64) *StringSliceCmd
- func (c Ring) SRandMember(key string) *StringCmd
- func (c Ring) SRandMemberN(key string, count int64) *StringSliceCmd
- func (c Ring) SRem(key string, members ...interface{}) *IntCmd
- func (c Ring) SScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) SUnion(keys ...string) *StringSliceCmd
- func (c Ring) SUnionStore(destination string, keys ...string) *IntCmd
- func (c Ring) Save() *StatusCmd
- func (c Ring) Scan(cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) ScriptExists(hashes ...string) *BoolSliceCmd
- func (c Ring) ScriptFlush() *StatusCmd
- func (c Ring) ScriptKill() *StatusCmd
- func (c Ring) ScriptLoad(script string) *StringCmd
- func (c Ring) Set(key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Ring) SetBit(key string, offset int64, value int) *IntCmd
- func (c Ring) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Ring) SetRange(key string, offset int64, value string) *IntCmd
- func (c Ring) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Ring) Shutdown() *StatusCmd
- func (c Ring) ShutdownNoSave() *StatusCmd
- func (c Ring) ShutdownSave() *StatusCmd
- func (c Ring) SlaveOf(host, port string) *StatusCmd
- func (c Ring) SlowLog()
- func (c Ring) Sort(key string, sort *Sort) *StringSliceCmd
- func (c Ring) SortInterfaces(key string, sort *Sort) *SliceCmd
- func (c Ring) SortStore(key, store string, sort *Sort) *IntCmd
- func (c Ring) StrLen(key string) *IntCmd
- func (c *Ring) Subscribe(channels ...string) *PubSub
- func (c Ring) Sync()
- func (c Ring) TTL(key string) *DurationCmd
- func (c Ring) Time() *TimeCmd
- func (c Ring) Touch(keys ...string) *IntCmd
- func (c *Ring) TxPipeline() Pipeliner
- func (c *Ring) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c Ring) Type(key string) *StatusCmd
- func (c Ring) Unlink(keys ...string) *IntCmd
- func (c Ring) Wait(numSlaves int, timeout time.Duration) *IntCmd
- func (c *Ring) Watch(fn func(*Tx) error, keys ...string) error
- func (c *Ring) WithContext(ctx context.Context) *Ring
- func (c Ring) XAck(stream, group string, ids ...string) *IntCmd
- func (c Ring) XAdd(a *XAddArgs) *StringCmd
- func (c Ring) XClaim(a *XClaimArgs) *XMessageSliceCmd
- func (c Ring) XClaimJustID(a *XClaimArgs) *StringSliceCmd
- func (c Ring) XDel(stream string, ids ...string) *IntCmd
- func (c Ring) XGroupCreate(stream, group, start string) *StatusCmd
- func (c Ring) XGroupCreateMkStream(stream, group, start string) *StatusCmd
- func (c Ring) XGroupDelConsumer(stream, group, consumer string) *IntCmd
- func (c Ring) XGroupDestroy(stream, group string) *IntCmd
- func (c Ring) XGroupSetID(stream, group, start string) *StatusCmd
- func (c Ring) XInfoGroups(key string) *XInfoGroupsCmd
- func (c Ring) XLen(stream string) *IntCmd
- func (c Ring) XPending(stream, group string) *XPendingCmd
- func (c Ring) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
- func (c Ring) XRange(stream, start, stop string) *XMessageSliceCmd
- func (c Ring) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Ring) XRead(a *XReadArgs) *XStreamSliceCmd
- func (c Ring) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
- func (c Ring) XReadStreams(streams ...string) *XStreamSliceCmd
- func (c Ring) XRevRange(stream, start, stop string) *XMessageSliceCmd
- func (c Ring) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Ring) XTrim(key string, maxLen int64) *IntCmd
- func (c Ring) XTrimApprox(key string, maxLen int64) *IntCmd
- func (c Ring) ZAdd(key string, members ...*Z) *IntCmd
- func (c Ring) ZAddCh(key string, members ...*Z) *IntCmd
- func (c Ring) ZAddNX(key string, members ...*Z) *IntCmd
- func (c Ring) ZAddNXCh(key string, members ...*Z) *IntCmd
- func (c Ring) ZAddXX(key string, members ...*Z) *IntCmd
- func (c Ring) ZAddXXCh(key string, members ...*Z) *IntCmd
- func (c Ring) ZCard(key string) *IntCmd
- func (c Ring) ZCount(key, min, max string) *IntCmd
- func (c Ring) ZIncr(key string, member *Z) *FloatCmd
- func (c Ring) ZIncrBy(key string, increment float64, member string) *FloatCmd
- func (c Ring) ZIncrNX(key string, member *Z) *FloatCmd
- func (c Ring) ZIncrXX(key string, member *Z) *FloatCmd
- func (c Ring) ZInterStore(destination string, store *ZStore) *IntCmd
- func (c Ring) ZLexCount(key, min, max string) *IntCmd
- func (c Ring) ZPopMax(key string, count ...int64) *ZSliceCmd
- func (c Ring) ZPopMin(key string, count ...int64) *ZSliceCmd
- func (c Ring) ZRange(key string, start, stop int64) *StringSliceCmd
- func (c Ring) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Ring) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Ring) ZRank(key, member string) *IntCmd
- func (c Ring) ZRem(key string, members ...interface{}) *IntCmd
- func (c Ring) ZRemRangeByLex(key, min, max string) *IntCmd
- func (c Ring) ZRemRangeByRank(key string, start, stop int64) *IntCmd
- func (c Ring) ZRemRangeByScore(key, min, max string) *IntCmd
- func (c Ring) ZRevRange(key string, start, stop int64) *StringSliceCmd
- func (c Ring) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Ring) ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Ring) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Ring) ZRevRank(key, member string) *IntCmd
- func (c Ring) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Ring) ZScore(key, member string) *FloatCmd
- func (c Ring) ZUnionStore(dest string, store *ZStore) *IntCmd
- type RingOptions
- type ScanCmd
- func (cmd *ScanCmd) Args() []interface{}
- func (cmd *ScanCmd) Err() error
- func (cmd *ScanCmd) Iterator() *ScanIterator
- func (cmd *ScanCmd) Name() string
- func (cmd *ScanCmd) Result() (keys []string, cursor uint64, err error)
- func (cmd *ScanCmd) String() string
- func (cmd *ScanCmd) Val() (keys []string, cursor uint64)
- type ScanIterator
- type Script
- func (s *Script) Eval(c scripter, keys []string, args ...interface{}) *Cmd
- func (s *Script) EvalSha(c scripter, keys []string, args ...interface{}) *Cmd
- func (s *Script) Exists(c scripter) *BoolSliceCmd
- func (s *Script) Hash() string
- func (s *Script) Load(c scripter) *StringCmd
- func (s *Script) Run(c scripter, keys []string, args ...interface{}) *Cmd
- type SentinelClient
- func (c *SentinelClient) CkQuorum(name string) *StringCmd
- func (c SentinelClient) Close() error
- func (c *SentinelClient) Context() context.Context
- func (c *SentinelClient) Failover(name string) *StatusCmd
- func (c *SentinelClient) FlushConfig() *StatusCmd
- func (c *SentinelClient) GetMasterAddrByName(name string) *StringSliceCmd
- func (c *SentinelClient) Master(name string) *StringStringMapCmd
- func (c *SentinelClient) Masters() *SliceCmd
- func (c *SentinelClient) Monitor(name, ip, port, quorum string) *StringCmd
- func (c *SentinelClient) PSubscribe(channels ...string) *PubSub
- func (c *SentinelClient) Ping() *StringCmd
- func (c *SentinelClient) Process(cmd Cmder) error
- func (c *SentinelClient) ProcessContext(ctx context.Context, cmd Cmder) error
- func (c *SentinelClient) Remove(name string) *StringCmd
- func (c *SentinelClient) Reset(pattern string) *IntCmd
- func (c *SentinelClient) Sentinels(name string) *SliceCmd
- func (c *SentinelClient) Set(name, option, value string) *StringCmd
- func (c *SentinelClient) Slaves(name string) *SliceCmd
- func (c SentinelClient) String() string
- func (c *SentinelClient) Subscribe(channels ...string) *PubSub
- func (c *SentinelClient) WithContext(ctx context.Context) *SentinelClient
- type SliceCmd
- type Sort
- type StatefulCmdable
- type StatusCmd
- type StringCmd
- func (cmd *StringCmd) Args() []interface{}
- 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) 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) String() string
- func (cmd *StringCmd) Time() (time.Time, error)
- func (cmd *StringCmd) Uint64() (uint64, error)
- func (cmd *StringCmd) Val() string
- type StringIntMapCmd
- type StringSliceCmd
- func (cmd *StringSliceCmd) Args() []interface{}
- func (cmd *StringSliceCmd) Err() error
- func (cmd *StringSliceCmd) Name() string
- func (cmd *StringSliceCmd) Result() ([]string, error)
- func (cmd *StringSliceCmd) ScanSlice(container interface{}) 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) Name() string
- func (cmd *StringStringMapCmd) Result() (map[string]string, 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) Name() string
- func (cmd *StringStructMapCmd) Result() (map[string]struct{}, error)
- func (cmd *StringStructMapCmd) String() string
- func (cmd *StringStructMapCmd) Val() map[string]struct{}
- type Subscription
- type TimeCmd
- type Tx
- func (hs *Tx) AddHook(hook Hook)
- func (c Tx) Append(key, value string) *IntCmd
- func (c Tx) Auth(password string) *StatusCmd
- func (c Tx) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Tx) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
- func (c Tx) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd
- func (c Tx) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Tx) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
- func (c Tx) BgRewriteAOF() *StatusCmd
- func (c Tx) BgSave() *StatusCmd
- func (c Tx) BitCount(key string, bitCount *BitCount) *IntCmd
- func (c Tx) BitField(key string, args ...interface{}) *IntSliceCmd
- func (c Tx) BitOpAnd(destKey string, keys ...string) *IntCmd
- func (c Tx) BitOpNot(destKey string, key string) *IntCmd
- func (c Tx) BitOpOr(destKey string, keys ...string) *IntCmd
- func (c Tx) BitOpXor(destKey string, keys ...string) *IntCmd
- func (c Tx) BitPos(key string, bit int64, pos ...int64) *IntCmd
- func (c Tx) ClientGetName() *StringCmd
- func (c Tx) ClientID() *IntCmd
- func (c Tx) ClientKill(ipPort string) *StatusCmd
- func (c Tx) ClientKillByFilter(keys ...string) *IntCmd
- func (c Tx) ClientList() *StringCmd
- func (c Tx) ClientPause(dur time.Duration) *BoolCmd
- func (c Tx) ClientSetName(name string) *BoolCmd
- func (c Tx) ClientUnblock(id int64) *IntCmd
- func (c Tx) ClientUnblockWithError(id int64) *IntCmd
- func (hs Tx) Clone() hooks
- func (c *Tx) Close() error
- func (c Tx) ClusterAddSlots(slots ...int) *StatusCmd
- func (c Tx) ClusterAddSlotsRange(min, max int) *StatusCmd
- func (c Tx) ClusterCountFailureReports(nodeID string) *IntCmd
- func (c Tx) ClusterCountKeysInSlot(slot int) *IntCmd
- func (c Tx) ClusterDelSlots(slots ...int) *StatusCmd
- func (c Tx) ClusterDelSlotsRange(min, max int) *StatusCmd
- func (c Tx) ClusterFailover() *StatusCmd
- func (c Tx) ClusterForget(nodeID string) *StatusCmd
- func (c Tx) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
- func (c Tx) ClusterInfo() *StringCmd
- func (c Tx) ClusterKeySlot(key string) *IntCmd
- func (c Tx) ClusterMeet(host, port string) *StatusCmd
- func (c Tx) ClusterNodes() *StringCmd
- func (c Tx) ClusterReplicate(nodeID string) *StatusCmd
- func (c Tx) ClusterResetHard() *StatusCmd
- func (c Tx) ClusterResetSoft() *StatusCmd
- func (c Tx) ClusterSaveConfig() *StatusCmd
- func (c Tx) ClusterSlaves(nodeID string) *StringSliceCmd
- func (c Tx) ClusterSlots() *ClusterSlotsCmd
- func (c Tx) Command() *CommandsInfoCmd
- func (c Tx) ConfigGet(parameter string) *SliceCmd
- func (c Tx) ConfigResetStat() *StatusCmd
- func (c Tx) ConfigRewrite() *StatusCmd
- func (c Tx) ConfigSet(parameter, value string) *StatusCmd
- func (c *Tx) Context() context.Context
- func (c Tx) DBSize() *IntCmd
- func (c Tx) DbSize() *IntCmd
- func (c Tx) DebugObject(key string) *StringCmd
- func (c Tx) Decr(key string) *IntCmd
- func (c Tx) DecrBy(key string, decrement int64) *IntCmd
- func (c Tx) Del(keys ...string) *IntCmd
- func (c Tx) Dump(key string) *StringCmd
- func (c Tx) Echo(message interface{}) *StringCmd
- func (c Tx) Eval(script string, keys []string, args ...interface{}) *Cmd
- func (c Tx) EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd
- func (c Tx) Exists(keys ...string) *IntCmd
- func (c Tx) Expire(key string, expiration time.Duration) *BoolCmd
- func (c Tx) ExpireAt(key string, tm time.Time) *BoolCmd
- func (c Tx) FlushAll() *StatusCmd
- func (c Tx) FlushAllAsync() *StatusCmd
- func (c Tx) FlushDB() *StatusCmd
- func (c Tx) FlushDBAsync() *StatusCmd
- func (c Tx) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
- func (c Tx) GeoDist(key string, member1, member2, unit string) *FloatCmd
- func (c Tx) GeoHash(key string, members ...string) *StringSliceCmd
- func (c Tx) GeoPos(key string, members ...string) *GeoPosCmd
- func (c Tx) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Tx) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
- func (c Tx) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
- func (c Tx) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
- func (c Tx) Get(key string) *StringCmd
- func (c Tx) GetBit(key string, offset int64) *IntCmd
- func (c Tx) GetRange(key string, start, end int64) *StringCmd
- func (c Tx) GetSet(key string, value interface{}) *StringCmd
- func (c Tx) HDel(key string, fields ...string) *IntCmd
- func (c Tx) HExists(key, field string) *BoolCmd
- func (c Tx) HGet(key, field string) *StringCmd
- func (c Tx) HGetAll(key string) *StringStringMapCmd
- func (c Tx) HIncrBy(key, field string, incr int64) *IntCmd
- func (c Tx) HIncrByFloat(key, field string, incr float64) *FloatCmd
- func (c Tx) HKeys(key string) *StringSliceCmd
- func (c Tx) HLen(key string) *IntCmd
- func (c Tx) HMGet(key string, fields ...string) *SliceCmd
- func (c Tx) HMSet(key string, values ...interface{}) *IntCmd
- func (c Tx) HScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) HSet(key, field string, value interface{}) *BoolCmd
- func (c Tx) HSetNX(key, field string, value interface{}) *BoolCmd
- func (c Tx) HVals(key string) *StringSliceCmd
- func (c Tx) Incr(key string) *IntCmd
- func (c Tx) IncrBy(key string, value int64) *IntCmd
- func (c Tx) IncrByFloat(key string, value float64) *FloatCmd
- func (c Tx) Info(section ...string) *StringCmd
- func (c Tx) Keys(pattern string) *StringSliceCmd
- func (c Tx) LIndex(key string, index int64) *StringCmd
- func (c Tx) LInsert(key, op string, pivot, value interface{}) *IntCmd
- func (c Tx) LInsertAfter(key string, pivot, value interface{}) *IntCmd
- func (c Tx) LInsertBefore(key string, pivot, value interface{}) *IntCmd
- func (c Tx) LLen(key string) *IntCmd
- func (c Tx) LPop(key string) *StringCmd
- func (c Tx) LPush(key string, values ...interface{}) *IntCmd
- func (c Tx) LPushX(key string, values ...interface{}) *IntCmd
- func (c Tx) LRange(key string, start, stop int64) *StringSliceCmd
- func (c Tx) LRem(key string, count int64, value interface{}) *IntCmd
- func (c Tx) LSet(key string, index int64, value interface{}) *StatusCmd
- func (c Tx) LTrim(key string, start, stop int64) *StatusCmd
- func (c Tx) LastSave() *IntCmd
- func (hs *Tx) Lock()
- func (c Tx) MGet(keys ...string) *SliceCmd
- func (c Tx) MSet(values ...interface{}) *StatusCmd
- func (c Tx) MSetNX(values ...interface{}) *BoolCmd
- func (c Tx) MemoryUsage(key string, samples ...int) *IntCmd
- func (c Tx) Migrate(host, port, key string, db int, timeout time.Duration) *StatusCmd
- func (c Tx) Move(key string, db int) *BoolCmd
- func (c Tx) ObjectEncoding(key string) *StringCmd
- func (c Tx) ObjectIdleTime(key string) *DurationCmd
- func (c Tx) ObjectRefCount(key string) *IntCmd
- func (c Tx) PExpire(key string, expiration time.Duration) *BoolCmd
- func (c Tx) PExpireAt(key string, tm time.Time) *BoolCmd
- func (c Tx) PFAdd(key string, els ...interface{}) *IntCmd
- func (c Tx) PFCount(keys ...string) *IntCmd
- func (c Tx) PFMerge(dest string, keys ...string) *StatusCmd
- func (c Tx) PTTL(key string) *DurationCmd
- func (c Tx) Persist(key string) *BoolCmd
- func (c Tx) Ping() *StatusCmd
- func (c *Tx) Pipeline() Pipeliner
- func (c *Tx) Pipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c *Tx) Process(cmd Cmder) error
- func (c *Tx) ProcessContext(ctx context.Context, cmd Cmder) error
- func (c Tx) PubSubChannels(pattern string) *StringSliceCmd
- func (c Tx) PubSubNumPat() *IntCmd
- func (c Tx) PubSubNumSub(channels ...string) *StringIntMapCmd
- func (c Tx) Publish(channel string, message interface{}) *IntCmd
- func (c Tx) Quit() *StatusCmd
- func (c Tx) RPop(key string) *StringCmd
- func (c Tx) RPopLPush(source, destination string) *StringCmd
- func (c Tx) RPush(key string, values ...interface{}) *IntCmd
- func (c Tx) RPushX(key string, values ...interface{}) *IntCmd
- func (c Tx) RandomKey() *StringCmd
- func (c Tx) ReadOnly() *StatusCmd
- func (c Tx) ReadWrite() *StatusCmd
- func (c Tx) Rename(key, newkey string) *StatusCmd
- func (c Tx) RenameNX(key, newkey string) *BoolCmd
- func (c Tx) Restore(key string, ttl time.Duration, value string) *StatusCmd
- func (c Tx) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd
- func (c Tx) SAdd(key string, members ...interface{}) *IntCmd
- func (c Tx) SCard(key string) *IntCmd
- func (c Tx) SDiff(keys ...string) *StringSliceCmd
- func (c Tx) SDiffStore(destination string, keys ...string) *IntCmd
- func (c Tx) SInter(keys ...string) *StringSliceCmd
- func (c Tx) SInterStore(destination string, keys ...string) *IntCmd
- func (c Tx) SIsMember(key string, member interface{}) *BoolCmd
- func (c Tx) SMembers(key string) *StringSliceCmd
- func (c Tx) SMembersMap(key string) *StringStructMapCmd
- func (c Tx) SMove(source, destination string, member interface{}) *BoolCmd
- func (c Tx) SPop(key string) *StringCmd
- func (c Tx) SPopN(key string, count int64) *StringSliceCmd
- func (c Tx) SRandMember(key string) *StringCmd
- func (c Tx) SRandMemberN(key string, count int64) *StringSliceCmd
- func (c Tx) SRem(key string, members ...interface{}) *IntCmd
- func (c Tx) SScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) SUnion(keys ...string) *StringSliceCmd
- func (c Tx) SUnionStore(destination string, keys ...string) *IntCmd
- func (c Tx) Save() *StatusCmd
- func (c Tx) Scan(cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) ScriptExists(hashes ...string) *BoolSliceCmd
- func (c Tx) ScriptFlush() *StatusCmd
- func (c Tx) ScriptKill() *StatusCmd
- func (c Tx) ScriptLoad(script string) *StringCmd
- func (c Tx) Select(index int) *StatusCmd
- func (c Tx) Set(key string, value interface{}, expiration time.Duration) *StatusCmd
- func (c Tx) SetBit(key string, offset int64, value int) *IntCmd
- func (c Tx) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Tx) SetRange(key string, offset int64, value string) *IntCmd
- func (c Tx) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd
- func (c Tx) Shutdown() *StatusCmd
- func (c Tx) ShutdownNoSave() *StatusCmd
- func (c Tx) ShutdownSave() *StatusCmd
- func (c Tx) SlaveOf(host, port string) *StatusCmd
- func (c Tx) SlowLog()
- func (c Tx) Sort(key string, sort *Sort) *StringSliceCmd
- func (c Tx) SortInterfaces(key string, sort *Sort) *SliceCmd
- func (c Tx) SortStore(key, store string, sort *Sort) *IntCmd
- func (c Tx) StrLen(key string) *IntCmd
- func (c *Tx) String() string
- func (c Tx) SwapDB(index1, index2 int) *StatusCmd
- func (c Tx) Sync()
- func (c Tx) TTL(key string) *DurationCmd
- func (c Tx) Time() *TimeCmd
- func (c Tx) Touch(keys ...string) *IntCmd
- func (c *Tx) TxPipeline() Pipeliner
- func (c *Tx) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error)
- func (c Tx) Type(key string) *StatusCmd
- func (c Tx) Unlink(keys ...string) *IntCmd
- func (c *Tx) Unwatch(keys ...string) *StatusCmd
- func (c Tx) Wait(numSlaves int, timeout time.Duration) *IntCmd
- func (c *Tx) Watch(keys ...string) *StatusCmd
- func (c *Tx) WithContext(ctx context.Context) *Tx
- func (c Tx) XAck(stream, group string, ids ...string) *IntCmd
- func (c Tx) XAdd(a *XAddArgs) *StringCmd
- func (c Tx) XClaim(a *XClaimArgs) *XMessageSliceCmd
- func (c Tx) XClaimJustID(a *XClaimArgs) *StringSliceCmd
- func (c Tx) XDel(stream string, ids ...string) *IntCmd
- func (c Tx) XGroupCreate(stream, group, start string) *StatusCmd
- func (c Tx) XGroupCreateMkStream(stream, group, start string) *StatusCmd
- func (c Tx) XGroupDelConsumer(stream, group, consumer string) *IntCmd
- func (c Tx) XGroupDestroy(stream, group string) *IntCmd
- func (c Tx) XGroupSetID(stream, group, start string) *StatusCmd
- func (c Tx) XInfoGroups(key string) *XInfoGroupsCmd
- func (c Tx) XLen(stream string) *IntCmd
- func (c Tx) XPending(stream, group string) *XPendingCmd
- func (c Tx) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
- func (c Tx) XRange(stream, start, stop string) *XMessageSliceCmd
- func (c Tx) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Tx) XRead(a *XReadArgs) *XStreamSliceCmd
- func (c Tx) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
- func (c Tx) XReadStreams(streams ...string) *XStreamSliceCmd
- func (c Tx) XRevRange(stream, start, stop string) *XMessageSliceCmd
- func (c Tx) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
- func (c Tx) XTrim(key string, maxLen int64) *IntCmd
- func (c Tx) XTrimApprox(key string, maxLen int64) *IntCmd
- func (c Tx) ZAdd(key string, members ...*Z) *IntCmd
- func (c Tx) ZAddCh(key string, members ...*Z) *IntCmd
- func (c Tx) ZAddNX(key string, members ...*Z) *IntCmd
- func (c Tx) ZAddNXCh(key string, members ...*Z) *IntCmd
- func (c Tx) ZAddXX(key string, members ...*Z) *IntCmd
- func (c Tx) ZAddXXCh(key string, members ...*Z) *IntCmd
- func (c Tx) ZCard(key string) *IntCmd
- func (c Tx) ZCount(key, min, max string) *IntCmd
- func (c Tx) ZIncr(key string, member *Z) *FloatCmd
- func (c Tx) ZIncrBy(key string, increment float64, member string) *FloatCmd
- func (c Tx) ZIncrNX(key string, member *Z) *FloatCmd
- func (c Tx) ZIncrXX(key string, member *Z) *FloatCmd
- func (c Tx) ZInterStore(destination string, store *ZStore) *IntCmd
- func (c Tx) ZLexCount(key, min, max string) *IntCmd
- func (c Tx) ZPopMax(key string, count ...int64) *ZSliceCmd
- func (c Tx) ZPopMin(key string, count ...int64) *ZSliceCmd
- func (c Tx) ZRange(key string, start, stop int64) *StringSliceCmd
- func (c Tx) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Tx) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Tx) ZRank(key, member string) *IntCmd
- func (c Tx) ZRem(key string, members ...interface{}) *IntCmd
- func (c Tx) ZRemRangeByLex(key, min, max string) *IntCmd
- func (c Tx) ZRemRangeByRank(key string, start, stop int64) *IntCmd
- func (c Tx) ZRemRangeByScore(key, min, max string) *IntCmd
- func (c Tx) ZRevRange(key string, start, stop int64) *StringSliceCmd
- func (c Tx) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
- func (c Tx) ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd
- func (c Tx) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd
- func (c Tx) ZRevRank(key, member string) *IntCmd
- func (c Tx) ZScan(key string, cursor uint64, match string, count int64) *ScanCmd
- func (c Tx) ZScore(key, member string) *FloatCmd
- func (c Tx) ZUnionStore(dest string, store *ZStore) *IntCmd
- type UniversalClient
- type UniversalOptions
- type XAddArgs
- type XClaimArgs
- type XInfoGroups
- type XInfoGroupsCmd
- type XMessage
- type XMessageSliceCmd
- type XPending
- type XPendingCmd
- type XPendingExt
- type XPendingExtArgs
- type XPendingExtCmd
- type XReadArgs
- type XReadGroupArgs
- type XStream
- type XStreamSliceCmd
- type Z
- type ZRangeBy
- type ZSliceCmd
- type ZStore
- type ZWithKey
- type ZWithKeyCmd
Examples ¶
- Package (CustomCommand)
- Package (CustomCommand2)
- Package (Instrumentation)
- Client
- Client.BLPop
- Client.Incr
- Client.Pipeline
- Client.Pipelined
- Client.Scan
- Client.Set
- Client.TxPipeline
- Client.TxPipelined
- Client.Watch
- Conn
- NewClient
- NewClusterClient
- NewClusterClient (ManualSetup)
- NewFailoverClient
- NewRing
- NewUniversalClient (Cluster)
- NewUniversalClient (Failover)
- NewUniversalClient (Simple)
- ParseURL
- Pipeline (Instrumentation)
- PubSub
- PubSub.Receive
- ScanCmd.Iterator
- ScanIterator
- Script
Constants ¶
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 CustomErrorsToRetry = func(err error) bool { return false }
CustomErrorsToRetry is a function that can be set up to define custom errors for which retries should be performed.
Functions ¶
Types ¶
type BoolCmd ¶
type BoolCmd struct {
// contains filtered or unexported fields
}
func NewBoolCmd ¶
func NewBoolCmd(args ...interface{}) *BoolCmd
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(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 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("key", "value", 0).Err() if err != nil { panic(err) } val, err := rdb.Get("key").Result() if err != nil { panic(err) } fmt.Println("key", val) val2, err := rdb.Get("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().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()
Output:
func (Client) BLPop ¶
func (c Client) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
Example ¶
if err := rdb.RPush("queue", "message").Err(); err != nil { panic(err) } // use `rdb.BLPop(0, "queue")` for infinite waiting time result, err := rdb.BLPop(1*time.Second, "queue").Result() if err != nil { panic(err) } fmt.Println(result[0], result[1])
Output: queue message
func (Client) BRPopLPush ¶
func (Client) BZPopMax ¶
func (c Client) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMAX key [key ...] timeout` command.
func (Client) BZPopMin ¶
func (c Client) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMIN key [key ...] timeout` command.
func (Client) BgRewriteAOF ¶
func (c Client) BgRewriteAOF() *StatusCmd
func (Client) BitField ¶
func (c Client) BitField(key string, args ...interface{}) *IntSliceCmd
func (Client) ClientGetName ¶
func (c Client) ClientGetName() *StringCmd
ClientGetName returns the name of the connection.
func (Client) ClientKill ¶
func (Client) ClientKillByFilter ¶
ClientKillByFilter is new style synx, while the ClientKill is old CLIENT KILL <option> [value] ... <option> [value]
func (Client) ClientList ¶
func (c Client) ClientList() *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() *StatusCmd
func (Client) ClusterForget ¶
func (Client) ClusterGetKeysInSlot ¶
func (c Client) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
func (Client) ClusterInfo ¶
func (c Client) ClusterInfo() *StringCmd
func (Client) ClusterKeySlot ¶
func (Client) ClusterMeet ¶
func (Client) ClusterNodes ¶
func (c Client) ClusterNodes() *StringCmd
func (Client) ClusterReplicate ¶
func (Client) ClusterResetHard ¶
func (c Client) ClusterResetHard() *StatusCmd
func (Client) ClusterResetSoft ¶
func (c Client) ClusterResetSoft() *StatusCmd
func (Client) ClusterSaveConfig ¶
func (c Client) ClusterSaveConfig() *StatusCmd
func (Client) ClusterSlaves ¶
func (c Client) ClusterSlaves(nodeID string) *StringSliceCmd
func (Client) ClusterSlots ¶
func (c Client) ClusterSlots() *ClusterSlotsCmd
func (Client) Command ¶
func (c Client) Command() *CommandsInfoCmd
func (Client) ConfigResetStat ¶
func (c Client) ConfigResetStat() *StatusCmd
func (Client) ConfigRewrite ¶
func (c Client) ConfigRewrite() *StatusCmd
func (Client) DebugObject ¶
func (Client) FlushAllAsync ¶
func (c Client) FlushAllAsync() *StatusCmd
func (Client) FlushDBAsync ¶
func (c Client) FlushDBAsync() *StatusCmd
func (Client) GeoAdd ¶
func (c Client) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
func (Client) GeoHash ¶
func (c Client) GeoHash(key string, members ...string) *StringSliceCmd
func (Client) GeoRadius ¶
func (c Client) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Client) GeoRadiusByMember ¶
func (c Client) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUSBYMEMBER_RO command.
func (Client) GeoRadiusByMemberStore ¶
func (c Client) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Client) GeoRadiusStore ¶
func (c Client) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Client) HGetAll ¶
func (c Client) HGetAll(key string) *StringStringMapCmd
func (Client) HIncrByFloat ¶
func (Client) HKeys ¶
func (c Client) HKeys(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) HMSet ¶
HMSet is like HSet, but accepts multiple values:
- HMSet("key1", "value1", "key2", "value2")
- HMSet([]string{"key1", "value1", "key2", "value2"})
- HMSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it uses HSET Redis command underneath because HMSET is deprecated.
func (Client) HVals ¶
func (c Client) HVals(key string) *StringSliceCmd
func (Client) Incr ¶
Example ¶
result, err := rdb.Incr("counter").Result() if err != nil { panic(err) } fmt.Println(result)
Output: 1
func (Client) IncrByFloat ¶
func (Client) Keys ¶
func (c Client) Keys(pattern string) *StringSliceCmd
func (Client) LInsertAfter ¶
func (Client) LInsertBefore ¶
func (Client) LRange ¶
func (c Client) LRange(key string, start, stop int64) *StringSliceCmd
func (Client) MSet ¶
func (c Client) MSet(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(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(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(key string) *DurationCmd
func (*Client) Pipeline ¶
Example ¶
pipe := rdb.Pipeline() incr := pipe.Incr("pipeline_counter") pipe.Expire("pipeline_counter", time.Hour) // Execute // // INCR pipeline_counter // EXPIRE pipeline_counts 3600 // // using one rdb-server roundtrip. _, err := pipe.Exec() fmt.Println(incr.Val(), err)
Output: 1 <nil>
func (*Client) Pipelined ¶
Example ¶
var incr *redis.IntCmd _, err := rdb.Pipelined(func(pipe redis.Pipeliner) error { incr = pipe.Incr("pipelined_counter") pipe.Expire("pipelined_counter", time.Hour) return nil }) fmt.Println(incr.Val(), err)
Output: 1 <nil>
func (*Client) ProcessContext ¶
func (Client) PubSubChannels ¶
func (c Client) PubSubChannels(pattern string) *StringSliceCmd
func (Client) PubSubNumPat ¶
func (c Client) PubSubNumPat() *IntCmd
func (Client) PubSubNumSub ¶
func (c Client) PubSubNumSub(channels ...string) *StringIntMapCmd
func (Client) RestoreReplace ¶
func (Client) SDiff ¶
func (c Client) SDiff(keys ...string) *StringSliceCmd
func (Client) SDiffStore ¶
func (Client) SInter ¶
func (c Client) SInter(keys ...string) *StringSliceCmd
func (Client) SInterStore ¶
func (Client) SMembers ¶
func (c Client) SMembers(key string) *StringSliceCmd
Redis `SMEMBERS key` command output as a slice
func (Client) SMembersMap ¶
func (c Client) SMembersMap(key string) *StringStructMapCmd
Redis `SMEMBERS key` command output as a map
func (Client) SPopN ¶
func (c Client) SPopN(key string, count int64) *StringSliceCmd
Redis `SPOP key count` command.
func (Client) SRandMember ¶
Redis `SRANDMEMBER key` command.
func (Client) SRandMemberN ¶
func (c Client) SRandMemberN(key string, count int64) *StringSliceCmd
Redis `SRANDMEMBER key count` command.
func (Client) SUnion ¶
func (c Client) SUnion(keys ...string) *StringSliceCmd
func (Client) SUnionStore ¶
func (Client) Scan ¶
Example ¶
rdb.FlushDB() for i := 0; i < 33; i++ { err := rdb.Set(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(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) ScriptExists ¶
func (c Client) ScriptExists(hashes ...string) *BoolSliceCmd
func (Client) ScriptFlush ¶
func (c Client) ScriptFlush() *StatusCmd
func (Client) ScriptKill ¶
func (c Client) ScriptKill() *StatusCmd
func (Client) ScriptLoad ¶
func (Client) Set ¶
Redis `SET key value [expiration]` command.
Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.
Example ¶
// Last argument is expiration. Zero means the key has no // expiration time. err := rdb.Set("key", "value", 0).Err() if err != nil { panic(err) } // key2 will expire in an hour. err = rdb.Set("key2", "value", time.Hour).Err() if err != nil { panic(err) }
Output:
func (*Client) SetLimiter ¶
func (Client) SetNX ¶
Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time.
func (Client) SetXX ¶
Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time.
func (Client) ShutdownNoSave ¶
func (c Client) ShutdownNoSave() *StatusCmd
func (Client) ShutdownSave ¶
func (c Client) ShutdownSave() *StatusCmd
func (Client) Sort ¶
func (c Client) Sort(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(key string) *DurationCmd
func (*Client) TxPipeline ¶
TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.
Example ¶
pipe := rdb.TxPipeline() incr := pipe.Incr("tx_pipeline_counter") pipe.Expire("tx_pipeline_counter", time.Hour) // Execute // // MULTI // INCR pipeline_counter // EXPIRE pipeline_counts 3600 // EXEC // // using one rdb-server roundtrip. _, err := pipe.Exec() fmt.Println(incr.Val(), err)
Output: 1 <nil>
func (*Client) TxPipelined ¶
Example ¶
var incr *redis.IntCmd _, err := rdb.TxPipelined(func(pipe redis.Pipeliner) error { incr = pipe.Incr("tx_pipelined_counter") pipe.Expire("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 routineCount = 100 // Transactionally increments key using GET and SET commands. increment := func(key string) error { txf := func(tx *redis.Tx) error { // get current value or zero n, err := tx.Get(key).Int() if err != nil && err != redis.Nil { return err } // actual opperation (local in optimistic lock) n++ // runs only if the watched keys remain unchanged _, err = tx.TxPipelined(func(pipe redis.Pipeliner) error { // pipe handles the error case pipe.Set(key, n, 0) return nil }) return err } for retries := routineCount; retries > 0; retries-- { err := rdb.Watch(txf, key) if err != redis.TxFailedErr { return err } // optimistic lock lost } return errors.New("increment reached maximum number of retries") } var wg sync.WaitGroup wg.Add(routineCount) for i := 0; i < routineCount; i++ { go func() { defer wg.Done() if err := increment("counter3"); err != nil { fmt.Println("increment error:", err) } }() } wg.Wait() n, err := rdb.Get("counter3").Int() fmt.Println("ended with", n, err)
Output: ended with 100 <nil>
func (*Client) WatchContext ¶
func (Client) XClaim ¶
func (c Client) XClaim(a *XClaimArgs) *XMessageSliceCmd
func (Client) XClaimJustID ¶
func (c Client) XClaimJustID(a *XClaimArgs) *StringSliceCmd
func (Client) XGroupCreate ¶
func (Client) XGroupCreateMkStream ¶
func (Client) XGroupDelConsumer ¶
func (Client) XGroupDestroy ¶
func (Client) XGroupSetID ¶
func (Client) XInfoGroups ¶
func (c Client) XInfoGroups(key string) *XInfoGroupsCmd
func (Client) XPending ¶
func (c Client) XPending(stream, group string) *XPendingCmd
func (Client) XPendingExt ¶
func (c Client) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
func (Client) XRange ¶
func (c Client) XRange(stream, start, stop string) *XMessageSliceCmd
func (Client) XRangeN ¶
func (c Client) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Client) XRead ¶
func (c Client) XRead(a *XReadArgs) *XStreamSliceCmd
func (Client) XReadGroup ¶
func (c Client) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
func (Client) XReadStreams ¶
func (c Client) XReadStreams(streams ...string) *XStreamSliceCmd
func (Client) XRevRange ¶
func (c Client) XRevRange(stream, start, stop string) *XMessageSliceCmd
func (Client) XRevRangeN ¶
func (c Client) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Client) XTrimApprox ¶
func (Client) ZInterStore ¶
func (Client) ZRange ¶
func (c Client) ZRange(key string, start, stop int64) *StringSliceCmd
func (Client) ZRangeByLex ¶
func (c Client) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRangeByScore ¶
func (c Client) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRangeByScoreWithScores ¶
func (Client) ZRangeWithScores ¶
func (Client) ZRemRangeByLex ¶
func (Client) ZRemRangeByRank ¶
func (Client) ZRemRangeByScore ¶
func (Client) ZRevRange ¶
func (c Client) ZRevRange(key string, start, stop int64) *StringSliceCmd
func (Client) ZRevRangeByLex ¶
func (c Client) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRevRangeByScore ¶
func (c Client) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Client) ZRevRangeByScoreWithScores ¶
func (Client) ZRevRangeWithScores ¶
func (Client) ZUnionStore ¶
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()
Output:
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() ([]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() // ReloadState reloads cluster state. It calls ClusterSlots func // to get cluster slots information. err := rdb.ReloadState() if err != nil { panic(err) }
Output:
func (ClusterClient) BLPop ¶
func (c ClusterClient) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
func (ClusterClient) BRPop ¶
func (c ClusterClient) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
func (ClusterClient) BRPopLPush ¶
func (ClusterClient) BZPopMax ¶
func (c ClusterClient) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMAX key [key ...] timeout` command.
func (ClusterClient) BZPopMin ¶
func (c ClusterClient) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMIN key [key ...] timeout` command.
func (ClusterClient) BgRewriteAOF ¶
func (c ClusterClient) BgRewriteAOF() *StatusCmd
func (ClusterClient) BitField ¶
func (c ClusterClient) BitField(key string, args ...interface{}) *IntSliceCmd
func (ClusterClient) ClientGetName ¶
func (c ClusterClient) ClientGetName() *StringCmd
ClientGetName returns the name of the connection.
func (ClusterClient) ClientKill ¶
func (ClusterClient) ClientKillByFilter ¶
ClientKillByFilter is new style synx, while the ClientKill is old CLIENT KILL <option> [value] ... <option> [value]
func (ClusterClient) ClientList ¶
func (c ClusterClient) ClientList() *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() *StatusCmd
func (ClusterClient) ClusterForget ¶
func (ClusterClient) ClusterGetKeysInSlot ¶
func (c ClusterClient) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
func (ClusterClient) ClusterInfo ¶
func (c ClusterClient) ClusterInfo() *StringCmd
func (ClusterClient) ClusterKeySlot ¶
func (ClusterClient) ClusterMeet ¶
func (ClusterClient) ClusterNodes ¶
func (c ClusterClient) ClusterNodes() *StringCmd
func (ClusterClient) ClusterReplicate ¶
func (ClusterClient) ClusterResetHard ¶
func (c ClusterClient) ClusterResetHard() *StatusCmd
func (ClusterClient) ClusterResetSoft ¶
func (c ClusterClient) ClusterResetSoft() *StatusCmd
func (ClusterClient) ClusterSaveConfig ¶
func (c ClusterClient) ClusterSaveConfig() *StatusCmd
func (ClusterClient) ClusterSlaves ¶
func (c ClusterClient) ClusterSlaves(nodeID string) *StringSliceCmd
func (ClusterClient) ClusterSlots ¶
func (c ClusterClient) ClusterSlots() *ClusterSlotsCmd
func (ClusterClient) Command ¶
func (c ClusterClient) Command() *CommandsInfoCmd
func (ClusterClient) ConfigResetStat ¶
func (c ClusterClient) ConfigResetStat() *StatusCmd
func (ClusterClient) ConfigRewrite ¶
func (c ClusterClient) ConfigRewrite() *StatusCmd
func (*ClusterClient) Context ¶
func (c *ClusterClient) Context() context.Context
func (*ClusterClient) DBSize ¶
func (c *ClusterClient) DBSize() *IntCmd
func (ClusterClient) DbSize ¶
func (c ClusterClient) DbSize() *IntCmd
Deperecated. Use DBSize instead.
func (ClusterClient) DebugObject ¶
func (*ClusterClient) Do ¶
func (c *ClusterClient) Do(args ...interface{}) *Cmd
Do creates a Cmd from the args and processes the cmd.
func (*ClusterClient) DoContext ¶
func (c *ClusterClient) DoContext(ctx context.Context, args ...interface{}) *Cmd
func (ClusterClient) FlushAllAsync ¶
func (c ClusterClient) FlushAllAsync() *StatusCmd
func (ClusterClient) FlushDBAsync ¶
func (c ClusterClient) FlushDBAsync() *StatusCmd
func (*ClusterClient) ForEachMaster ¶
func (c *ClusterClient) ForEachMaster(fn func(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) ForEachNode ¶
func (c *ClusterClient) ForEachNode(fn func(client *Client) error) error
ForEachNode 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(fn func(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(key string, geoLocation ...*GeoLocation) *IntCmd
func (ClusterClient) GeoHash ¶
func (c ClusterClient) GeoHash(key string, members ...string) *StringSliceCmd
func (ClusterClient) GeoRadius ¶
func (c ClusterClient) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (ClusterClient) GeoRadiusByMember ¶
func (c ClusterClient) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUSBYMEMBER_RO command.
func (ClusterClient) GeoRadiusByMemberStore ¶
func (c ClusterClient) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (ClusterClient) GeoRadiusStore ¶
func (c ClusterClient) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (ClusterClient) Get ¶
Redis `GET key` command. It returns redis.Nil error when key does not exist.
func (ClusterClient) HGetAll ¶
func (c ClusterClient) HGetAll(key string) *StringStringMapCmd
func (ClusterClient) HIncrByFloat ¶
func (ClusterClient) HKeys ¶
func (c ClusterClient) HKeys(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 like HSet, but accepts multiple values:
- HMSet("key1", "value1", "key2", "value2")
- HMSet([]string{"key1", "value1", "key2", "value2"})
- HMSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it uses HSET Redis command underneath because HMSET is deprecated.
func (ClusterClient) HVals ¶
func (c ClusterClient) HVals(key string) *StringSliceCmd
func (ClusterClient) IncrByFloat ¶
func (ClusterClient) Keys ¶
func (c ClusterClient) Keys(pattern string) *StringSliceCmd
func (ClusterClient) LInsertAfter ¶
func (ClusterClient) LInsertBefore ¶
func (ClusterClient) LRange ¶
func (c ClusterClient) LRange(key string, start, stop int64) *StringSliceCmd
func (ClusterClient) MSet ¶
func (c ClusterClient) MSet(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(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) MemoryUsage ¶
func (ClusterClient) ObjectEncoding ¶
func (ClusterClient) ObjectIdleTime ¶
func (c ClusterClient) ObjectIdleTime(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(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(key string) *DurationCmd
func (*ClusterClient) Pipeline ¶
func (c *ClusterClient) Pipeline() Pipeliner
func (*ClusterClient) Pipelined ¶
func (c *ClusterClient) Pipelined(fn func(Pipeliner) error) ([]Cmder, error)
func (*ClusterClient) PoolStats ¶
func (c *ClusterClient) PoolStats() *PoolStats
PoolStats returns accumulated connection pool stats.
func (*ClusterClient) Process ¶
func (c *ClusterClient) Process(cmd Cmder) error
func (*ClusterClient) ProcessContext ¶
func (c *ClusterClient) ProcessContext(ctx context.Context, cmd Cmder) error
func (ClusterClient) PubSubChannels ¶
func (c ClusterClient) PubSubChannels(pattern string) *StringSliceCmd
func (ClusterClient) PubSubNumPat ¶
func (c ClusterClient) PubSubNumPat() *IntCmd
func (ClusterClient) PubSubNumSub ¶
func (c ClusterClient) PubSubNumSub(channels ...string) *StringIntMapCmd
func (*ClusterClient) ReloadState ¶
func (c *ClusterClient) ReloadState() error
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(keys ...string) *StringSliceCmd
func (ClusterClient) SDiffStore ¶
func (ClusterClient) SInter ¶
func (c ClusterClient) SInter(keys ...string) *StringSliceCmd
func (ClusterClient) SInterStore ¶
func (ClusterClient) SMembers ¶
func (c ClusterClient) SMembers(key string) *StringSliceCmd
Redis `SMEMBERS key` command output as a slice
func (ClusterClient) SMembersMap ¶
func (c ClusterClient) SMembersMap(key string) *StringStructMapCmd
Redis `SMEMBERS key` command output as a map
func (ClusterClient) SPopN ¶
func (c ClusterClient) SPopN(key string, count int64) *StringSliceCmd
Redis `SPOP key count` command.
func (ClusterClient) SRandMember ¶
Redis `SRANDMEMBER key` command.
func (ClusterClient) SRandMemberN ¶
func (c ClusterClient) SRandMemberN(key string, count int64) *StringSliceCmd
Redis `SRANDMEMBER key count` command.
func (ClusterClient) SUnion ¶
func (c ClusterClient) SUnion(keys ...string) *StringSliceCmd
func (ClusterClient) SUnionStore ¶
func (ClusterClient) ScriptExists ¶
func (c ClusterClient) ScriptExists(hashes ...string) *BoolSliceCmd
func (ClusterClient) ScriptFlush ¶
func (c ClusterClient) ScriptFlush() *StatusCmd
func (ClusterClient) ScriptKill ¶
func (c ClusterClient) ScriptKill() *StatusCmd
func (ClusterClient) ScriptLoad ¶
func (ClusterClient) Set ¶
Redis `SET key value [expiration]` command.
Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.
func (ClusterClient) SetNX ¶
Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time.
func (ClusterClient) SetXX ¶
Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time.
func (ClusterClient) ShutdownNoSave ¶
func (c ClusterClient) ShutdownNoSave() *StatusCmd
func (ClusterClient) ShutdownSave ¶
func (c ClusterClient) ShutdownSave() *StatusCmd
func (ClusterClient) Sort ¶
func (c ClusterClient) Sort(key string, sort *Sort) *StringSliceCmd
func (ClusterClient) SortInterfaces ¶
func (*ClusterClient) Subscribe ¶
func (c *ClusterClient) Subscribe(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(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 (c *ClusterClient) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error)
func (*ClusterClient) Watch ¶
func (c *ClusterClient) Watch(fn func(*Tx) error, keys ...string) error
func (*ClusterClient) WatchContext ¶
func (*ClusterClient) WithContext ¶
func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient
func (ClusterClient) XClaim ¶
func (c ClusterClient) XClaim(a *XClaimArgs) *XMessageSliceCmd
func (ClusterClient) XClaimJustID ¶
func (c ClusterClient) XClaimJustID(a *XClaimArgs) *StringSliceCmd
func (ClusterClient) XGroupCreate ¶
func (ClusterClient) XGroupCreateMkStream ¶
func (ClusterClient) XGroupDelConsumer ¶
func (ClusterClient) XGroupDestroy ¶
func (ClusterClient) XGroupSetID ¶
func (ClusterClient) XInfoGroups ¶
func (c ClusterClient) XInfoGroups(key string) *XInfoGroupsCmd
func (ClusterClient) XPending ¶
func (c ClusterClient) XPending(stream, group string) *XPendingCmd
func (ClusterClient) XPendingExt ¶
func (c ClusterClient) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
func (ClusterClient) XRange ¶
func (c ClusterClient) XRange(stream, start, stop string) *XMessageSliceCmd
func (ClusterClient) XRangeN ¶
func (c ClusterClient) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (ClusterClient) XRead ¶
func (c ClusterClient) XRead(a *XReadArgs) *XStreamSliceCmd
func (ClusterClient) XReadGroup ¶
func (c ClusterClient) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
func (ClusterClient) XReadStreams ¶
func (c ClusterClient) XReadStreams(streams ...string) *XStreamSliceCmd
func (ClusterClient) XRevRange ¶
func (c ClusterClient) XRevRange(stream, start, stop string) *XMessageSliceCmd
func (ClusterClient) XRevRangeN ¶
func (c ClusterClient) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (ClusterClient) XTrimApprox ¶
func (ClusterClient) ZInterStore ¶
func (ClusterClient) ZRange ¶
func (c ClusterClient) ZRange(key string, start, stop int64) *StringSliceCmd
func (ClusterClient) ZRangeByLex ¶
func (c ClusterClient) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRangeByScore ¶
func (c ClusterClient) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRangeByScoreWithScores ¶
func (ClusterClient) ZRangeWithScores ¶
func (ClusterClient) ZRemRangeByLex ¶
func (ClusterClient) ZRemRangeByRank ¶
func (ClusterClient) ZRemRangeByScore ¶
func (ClusterClient) ZRevRange ¶
func (c ClusterClient) ZRevRange(key string, start, stop int64) *StringSliceCmd
func (ClusterClient) ZRevRangeByLex ¶
func (c ClusterClient) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRevRangeByScore ¶
func (c ClusterClient) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (ClusterClient) ZRevRangeByScoreWithScores ¶
func (ClusterClient) ZRevRangeWithScores ¶
func (ClusterClient) ZUnionStore ¶
type ClusterNode ¶
type ClusterOptions ¶
type ClusterOptions struct { // A seed list of host:port addresses of cluster nodes. Addrs []string // The maximum number of retries before giving up. Command is retried // on network errors and MOVED/ASK redirects. // Default is 8 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() ([]ClusterSlot, error) // Optional hook that is called when a new node is created. OnNewNode func(*Client) Dialer func(ctx context.Context, network, addr string) (net.Conn, error) OnConnect func(*Conn) error Password string MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration // 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(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(fn func(Pipeliner) error) ([]Cmder, error) TxPipelined(fn func(Pipeliner) error) ([]Cmder, error) TxPipeline() Pipeliner Command() *CommandsInfoCmd ClientGetName() *StringCmd Echo(message interface{}) *StringCmd Ping() *StatusCmd Quit() *StatusCmd Del(keys ...string) *IntCmd Unlink(keys ...string) *IntCmd Dump(key string) *StringCmd Exists(keys ...string) *IntCmd Expire(key string, expiration time.Duration) *BoolCmd ExpireAt(key string, tm time.Time) *BoolCmd Keys(pattern string) *StringSliceCmd Migrate(host, port, key string, db int, timeout time.Duration) *StatusCmd Move(key string, db int) *BoolCmd ObjectRefCount(key string) *IntCmd ObjectEncoding(key string) *StringCmd ObjectIdleTime(key string) *DurationCmd Persist(key string) *BoolCmd PExpire(key string, expiration time.Duration) *BoolCmd PExpireAt(key string, tm time.Time) *BoolCmd PTTL(key string) *DurationCmd RandomKey() *StringCmd Rename(key, newkey string) *StatusCmd RenameNX(key, newkey string) *BoolCmd Restore(key string, ttl time.Duration, value string) *StatusCmd RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd Sort(key string, sort *Sort) *StringSliceCmd SortStore(key, store string, sort *Sort) *IntCmd SortInterfaces(key string, sort *Sort) *SliceCmd Touch(keys ...string) *IntCmd TTL(key string) *DurationCmd Type(key string) *StatusCmd Scan(cursor uint64, match string, count int64) *ScanCmd SScan(key string, cursor uint64, match string, count int64) *ScanCmd HScan(key string, cursor uint64, match string, count int64) *ScanCmd ZScan(key string, cursor uint64, match string, count int64) *ScanCmd Append(key, value string) *IntCmd BitCount(key string, bitCount *BitCount) *IntCmd BitOpAnd(destKey string, keys ...string) *IntCmd BitOpOr(destKey string, keys ...string) *IntCmd BitOpXor(destKey string, keys ...string) *IntCmd BitOpNot(destKey string, key string) *IntCmd BitPos(key string, bit int64, pos ...int64) *IntCmd BitField(key string, args ...interface{}) *IntSliceCmd Decr(key string) *IntCmd DecrBy(key string, decrement int64) *IntCmd Get(key string) *StringCmd GetBit(key string, offset int64) *IntCmd GetRange(key string, start, end int64) *StringCmd GetSet(key string, value interface{}) *StringCmd Incr(key string) *IntCmd IncrBy(key string, value int64) *IntCmd IncrByFloat(key string, value float64) *FloatCmd MGet(keys ...string) *SliceCmd MSet(values ...interface{}) *StatusCmd MSetNX(values ...interface{}) *BoolCmd Set(key string, value interface{}, expiration time.Duration) *StatusCmd SetBit(key string, offset int64, value int) *IntCmd SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd SetRange(key string, offset int64, value string) *IntCmd StrLen(key string) *IntCmd HDel(key string, fields ...string) *IntCmd HExists(key, field string) *BoolCmd HGet(key, field string) *StringCmd HGetAll(key string) *StringStringMapCmd HIncrBy(key, field string, incr int64) *IntCmd HIncrByFloat(key, field string, incr float64) *FloatCmd HKeys(key string) *StringSliceCmd HLen(key string) *IntCmd HMGet(key string, fields ...string) *SliceCmd HMSet(key string, values ...interface{}) *IntCmd HSet(key, field string, value interface{}) *BoolCmd HSetNX(key, field string, value interface{}) *BoolCmd HVals(key string) *StringSliceCmd BLPop(timeout time.Duration, keys ...string) *StringSliceCmd BRPop(timeout time.Duration, keys ...string) *StringSliceCmd BRPopLPush(source, destination string, timeout time.Duration) *StringCmd LIndex(key string, index int64) *StringCmd LInsert(key, op string, pivot, value interface{}) *IntCmd LInsertBefore(key string, pivot, value interface{}) *IntCmd LInsertAfter(key string, pivot, value interface{}) *IntCmd LLen(key string) *IntCmd LPop(key string) *StringCmd LPush(key string, values ...interface{}) *IntCmd LPushX(key string, values ...interface{}) *IntCmd LRange(key string, start, stop int64) *StringSliceCmd LRem(key string, count int64, value interface{}) *IntCmd LSet(key string, index int64, value interface{}) *StatusCmd LTrim(key string, start, stop int64) *StatusCmd RPop(key string) *StringCmd RPopLPush(source, destination string) *StringCmd RPush(key string, values ...interface{}) *IntCmd RPushX(key string, values ...interface{}) *IntCmd SAdd(key string, members ...interface{}) *IntCmd SCard(key string) *IntCmd SDiff(keys ...string) *StringSliceCmd SDiffStore(destination string, keys ...string) *IntCmd SInter(keys ...string) *StringSliceCmd SInterStore(destination string, keys ...string) *IntCmd SIsMember(key string, member interface{}) *BoolCmd SMembers(key string) *StringSliceCmd SMembersMap(key string) *StringStructMapCmd SMove(source, destination string, member interface{}) *BoolCmd SPop(key string) *StringCmd SPopN(key string, count int64) *StringSliceCmd SRandMember(key string) *StringCmd SRandMemberN(key string, count int64) *StringSliceCmd SRem(key string, members ...interface{}) *IntCmd SUnion(keys ...string) *StringSliceCmd SUnionStore(destination string, keys ...string) *IntCmd XAdd(a *XAddArgs) *StringCmd XDel(stream string, ids ...string) *IntCmd XLen(stream string) *IntCmd XRange(stream, start, stop string) *XMessageSliceCmd XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd XRevRange(stream string, start, stop string) *XMessageSliceCmd XRevRangeN(stream string, start, stop string, count int64) *XMessageSliceCmd XRead(a *XReadArgs) *XStreamSliceCmd XReadStreams(streams ...string) *XStreamSliceCmd XGroupCreate(stream, group, start string) *StatusCmd XGroupCreateMkStream(stream, group, start string) *StatusCmd XGroupSetID(stream, group, start string) *StatusCmd XGroupDestroy(stream, group string) *IntCmd XGroupDelConsumer(stream, group, consumer string) *IntCmd XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd XAck(stream, group string, ids ...string) *IntCmd XPending(stream, group string) *XPendingCmd XPendingExt(a *XPendingExtArgs) *XPendingExtCmd XClaim(a *XClaimArgs) *XMessageSliceCmd XClaimJustID(a *XClaimArgs) *StringSliceCmd XTrim(key string, maxLen int64) *IntCmd XTrimApprox(key string, maxLen int64) *IntCmd XInfoGroups(key string) *XInfoGroupsCmd BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd ZAdd(key string, members ...*Z) *IntCmd ZAddNX(key string, members ...*Z) *IntCmd ZAddXX(key string, members ...*Z) *IntCmd ZAddCh(key string, members ...*Z) *IntCmd ZAddNXCh(key string, members ...*Z) *IntCmd ZAddXXCh(key string, members ...*Z) *IntCmd ZIncr(key string, member *Z) *FloatCmd ZIncrNX(key string, member *Z) *FloatCmd ZIncrXX(key string, member *Z) *FloatCmd ZCard(key string) *IntCmd ZCount(key, min, max string) *IntCmd ZLexCount(key, min, max string) *IntCmd ZIncrBy(key string, increment float64, member string) *FloatCmd ZInterStore(destination string, store *ZStore) *IntCmd ZPopMax(key string, count ...int64) *ZSliceCmd ZPopMin(key string, count ...int64) *ZSliceCmd ZRange(key string, start, stop int64) *StringSliceCmd ZRangeWithScores(key string, start, stop int64) *ZSliceCmd ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd ZRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd ZRank(key, member string) *IntCmd ZRem(key string, members ...interface{}) *IntCmd ZRemRangeByRank(key string, start, stop int64) *IntCmd ZRemRangeByScore(key, min, max string) *IntCmd ZRemRangeByLex(key, min, max string) *IntCmd ZRevRange(key string, start, stop int64) *StringSliceCmd ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd ZRevRangeByScoreWithScores(key string, opt *ZRangeBy) *ZSliceCmd ZRevRank(key, member string) *IntCmd ZScore(key, member string) *FloatCmd ZUnionStore(dest string, store *ZStore) *IntCmd PFAdd(key string, els ...interface{}) *IntCmd PFCount(keys ...string) *IntCmd PFMerge(dest string, keys ...string) *StatusCmd BgRewriteAOF() *StatusCmd BgSave() *StatusCmd ClientKill(ipPort string) *StatusCmd ClientKillByFilter(keys ...string) *IntCmd ClientList() *StringCmd ClientPause(dur time.Duration) *BoolCmd ClientID() *IntCmd ConfigGet(parameter string) *SliceCmd ConfigResetStat() *StatusCmd ConfigSet(parameter, value string) *StatusCmd ConfigRewrite() *StatusCmd DBSize() *IntCmd FlushAll() *StatusCmd FlushAllAsync() *StatusCmd FlushDB() *StatusCmd FlushDBAsync() *StatusCmd Info(section ...string) *StringCmd LastSave() *IntCmd Save() *StatusCmd Shutdown() *StatusCmd ShutdownSave() *StatusCmd ShutdownNoSave() *StatusCmd SlaveOf(host, port string) *StatusCmd Time() *TimeCmd Eval(script string, keys []string, args ...interface{}) *Cmd EvalSha(sha1 string, keys []string, args ...interface{}) *Cmd ScriptExists(hashes ...string) *BoolSliceCmd ScriptFlush() *StatusCmd ScriptKill() *StatusCmd ScriptLoad(script string) *StringCmd DebugObject(key string) *StringCmd Publish(channel string, message interface{}) *IntCmd PubSubChannels(pattern string) *StringSliceCmd PubSubNumSub(channels ...string) *StringIntMapCmd PubSubNumPat() *IntCmd ClusterSlots() *ClusterSlotsCmd ClusterNodes() *StringCmd ClusterMeet(host, port string) *StatusCmd ClusterForget(nodeID string) *StatusCmd ClusterReplicate(nodeID string) *StatusCmd ClusterResetSoft() *StatusCmd ClusterResetHard() *StatusCmd ClusterInfo() *StringCmd ClusterKeySlot(key string) *IntCmd ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd ClusterCountFailureReports(nodeID string) *IntCmd ClusterCountKeysInSlot(slot int) *IntCmd ClusterDelSlots(slots ...int) *StatusCmd ClusterDelSlotsRange(min, max int) *StatusCmd ClusterSaveConfig() *StatusCmd ClusterSlaves(nodeID string) *StringSliceCmd ClusterFailover() *StatusCmd ClusterAddSlots(slots ...int) *StatusCmd ClusterAddSlotsRange(min, max int) *StatusCmd GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd GeoPos(key string, members ...string) *GeoPosCmd GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd GeoDist(key string, member1, member2, unit string) *FloatCmd GeoHash(key string, members ...string) *StringSliceCmd ReadOnly() *StatusCmd ReadWrite() *StatusCmd MemoryUsage(key string, samples ...int) *IntCmd }
type CommandInfo ¶
type CommandsInfoCmd ¶
type CommandsInfoCmd struct {
// contains filtered or unexported fields
}
func NewCommandsInfoCmd ¶
func NewCommandsInfoCmd(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() err := conn.ClientSetName("foobar").Err() if err != nil { panic(err) } // Open other connections. for i := 0; i < 10; i++ { go rdb.Ping() } s, err := conn.ClientGetName().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 DurationCmd ¶
type DurationCmd struct {
// contains filtered or unexported fields
}
func NewDurationCmd ¶
func NewDurationCmd(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 FailoverOptions ¶
type FailoverOptions struct { // The master name. MasterName string // A seed list of host:port addresses of sentinel nodes. SentinelAddrs []string SentinelPassword string Dialer func(ctx context.Context, network, addr string) (net.Conn, error) OnConnect func(*Conn) error Password string DB int MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration 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 NewFloatCmd(args ...interface{}) *FloatCmd
func NewFloatResult ¶
NewFloatResult returns a FloatCmd initialised with val and err for testing
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(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 NewGeoPosCmd(args ...interface{}) *GeoPosCmd
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 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(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 previously allowed operation. // nil indicates a success, non-nil error 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(*Conn) error // Optional password. Must match the password specified in the // requirepass server configuration option. Password string // Database to be selected after connecting to the server. DB int // Maximum number of retries before giving up. // Default is to not retry failed commands. 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 // Maximum number of socket connections. // Default is 10 connections per every CPU as reported by runtime.NumCPU. 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 // contains filtered or unexported fields }
func ParseURL ¶
ParseURL parses an URL into Options that can be used to connect to Redis.
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(func(pipe redis.Pipeliner) error { pipe.Ping() pipe.Ping() return nil })
Output: pipeline starting processing: [ping: ping: ] pipeline finished processing: [ping: PONG ping: PONG]
func (Pipeline) BLPop ¶
func (c Pipeline) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
func (Pipeline) BRPop ¶
func (c Pipeline) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd
func (Pipeline) BRPopLPush ¶
func (Pipeline) BZPopMax ¶
func (c Pipeline) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMAX key [key ...] timeout` command.
func (Pipeline) BZPopMin ¶
func (c Pipeline) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMIN key [key ...] timeout` command.
func (Pipeline) BgRewriteAOF ¶
func (c Pipeline) BgRewriteAOF() *StatusCmd
func (Pipeline) BitField ¶
func (c Pipeline) BitField(key string, args ...interface{}) *IntSliceCmd
func (Pipeline) ClientGetName ¶
func (c Pipeline) ClientGetName() *StringCmd
ClientGetName returns the name of the connection.
func (Pipeline) ClientKill ¶
func (Pipeline) ClientKillByFilter ¶
ClientKillByFilter is new style synx, while the ClientKill is old CLIENT KILL <option> [value] ... <option> [value]
func (Pipeline) ClientList ¶
func (c Pipeline) ClientList() *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() *StatusCmd
func (Pipeline) ClusterForget ¶
func (Pipeline) ClusterGetKeysInSlot ¶
func (c Pipeline) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
func (Pipeline) ClusterInfo ¶
func (c Pipeline) ClusterInfo() *StringCmd
func (Pipeline) ClusterKeySlot ¶
func (Pipeline) ClusterMeet ¶
func (Pipeline) ClusterNodes ¶
func (c Pipeline) ClusterNodes() *StringCmd
func (Pipeline) ClusterReplicate ¶
func (Pipeline) ClusterResetHard ¶
func (c Pipeline) ClusterResetHard() *StatusCmd
func (Pipeline) ClusterResetSoft ¶
func (c Pipeline) ClusterResetSoft() *StatusCmd
func (Pipeline) ClusterSaveConfig ¶
func (c Pipeline) ClusterSaveConfig() *StatusCmd
func (Pipeline) ClusterSlaves ¶
func (c Pipeline) ClusterSlaves(nodeID string) *StringSliceCmd
func (Pipeline) ClusterSlots ¶
func (c Pipeline) ClusterSlots() *ClusterSlotsCmd
func (Pipeline) Command ¶
func (c Pipeline) Command() *CommandsInfoCmd
func (Pipeline) ConfigResetStat ¶
func (c Pipeline) ConfigResetStat() *StatusCmd
func (Pipeline) ConfigRewrite ¶
func (c Pipeline) ConfigRewrite() *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() *StatusCmd
func (Pipeline) FlushDBAsync ¶
func (c Pipeline) FlushDBAsync() *StatusCmd
func (Pipeline) GeoAdd ¶
func (c Pipeline) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
func (Pipeline) GeoHash ¶
func (c Pipeline) GeoHash(key string, members ...string) *StringSliceCmd
func (Pipeline) GeoRadius ¶
func (c Pipeline) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Pipeline) GeoRadiusByMember ¶
func (c Pipeline) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUSBYMEMBER_RO command.
func (Pipeline) GeoRadiusByMemberStore ¶
func (c Pipeline) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Pipeline) GeoRadiusStore ¶
func (c Pipeline) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Pipeline) HGetAll ¶
func (c Pipeline) HGetAll(key string) *StringStringMapCmd
func (Pipeline) HIncrByFloat ¶
func (Pipeline) HKeys ¶
func (c Pipeline) HKeys(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) HMSet ¶
HMSet is like HSet, but accepts multiple values:
- HMSet("key1", "value1", "key2", "value2")
- HMSet([]string{"key1", "value1", "key2", "value2"})
- HMSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it uses HSET Redis command underneath because HMSET is deprecated.
func (Pipeline) HVals ¶
func (c Pipeline) HVals(key string) *StringSliceCmd
func (Pipeline) IncrByFloat ¶
func (Pipeline) Keys ¶
func (c Pipeline) Keys(pattern string) *StringSliceCmd
func (Pipeline) LInsertAfter ¶
func (Pipeline) LInsertBefore ¶
func (Pipeline) LRange ¶
func (c Pipeline) LRange(key string, start, stop int64) *StringSliceCmd
func (Pipeline) MSet ¶
func (c Pipeline) MSet(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(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(key string) *DurationCmd
func (Pipeline) ObjectRefCount ¶
func (Pipeline) PTTL ¶
func (c Pipeline) PTTL(key string) *DurationCmd
func (Pipeline) PubSubChannels ¶
func (c Pipeline) PubSubChannels(pattern string) *StringSliceCmd
func (Pipeline) PubSubNumPat ¶
func (c Pipeline) PubSubNumPat() *IntCmd
func (Pipeline) PubSubNumSub ¶
func (c Pipeline) PubSubNumSub(channels ...string) *StringIntMapCmd
func (Pipeline) RestoreReplace ¶
func (Pipeline) SDiff ¶
func (c Pipeline) SDiff(keys ...string) *StringSliceCmd
func (Pipeline) SDiffStore ¶
func (Pipeline) SInter ¶
func (c Pipeline) SInter(keys ...string) *StringSliceCmd
func (Pipeline) SInterStore ¶
func (Pipeline) SMembers ¶
func (c Pipeline) SMembers(key string) *StringSliceCmd
Redis `SMEMBERS key` command output as a slice
func (Pipeline) SMembersMap ¶
func (c Pipeline) SMembersMap(key string) *StringStructMapCmd
Redis `SMEMBERS key` command output as a map
func (Pipeline) SPopN ¶
func (c Pipeline) SPopN(key string, count int64) *StringSliceCmd
Redis `SPOP key count` command.
func (Pipeline) SRandMember ¶
Redis `SRANDMEMBER key` command.
func (Pipeline) SRandMemberN ¶
func (c Pipeline) SRandMemberN(key string, count int64) *StringSliceCmd
Redis `SRANDMEMBER key count` command.
func (Pipeline) SUnion ¶
func (c Pipeline) SUnion(keys ...string) *StringSliceCmd
func (Pipeline) SUnionStore ¶
func (Pipeline) ScriptExists ¶
func (c Pipeline) ScriptExists(hashes ...string) *BoolSliceCmd
func (Pipeline) ScriptFlush ¶
func (c Pipeline) ScriptFlush() *StatusCmd
func (Pipeline) ScriptKill ¶
func (c Pipeline) ScriptKill() *StatusCmd
func (Pipeline) ScriptLoad ¶
func (Pipeline) Set ¶
Redis `SET key value [expiration]` command.
Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.
func (Pipeline) SetNX ¶
Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time.
func (Pipeline) SetXX ¶
Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time.
func (Pipeline) ShutdownNoSave ¶
func (c Pipeline) ShutdownNoSave() *StatusCmd
func (Pipeline) ShutdownSave ¶
func (c Pipeline) ShutdownSave() *StatusCmd
func (Pipeline) Sort ¶
func (c Pipeline) Sort(key string, sort *Sort) *StringSliceCmd
func (Pipeline) SortInterfaces ¶
func (Pipeline) TTL ¶
func (c Pipeline) TTL(key string) *DurationCmd
func (*Pipeline) TxPipeline ¶
func (*Pipeline) TxPipelined ¶
func (Pipeline) XClaim ¶
func (c Pipeline) XClaim(a *XClaimArgs) *XMessageSliceCmd
func (Pipeline) XClaimJustID ¶
func (c Pipeline) XClaimJustID(a *XClaimArgs) *StringSliceCmd
func (Pipeline) XGroupCreate ¶
func (Pipeline) XGroupCreateMkStream ¶
func (Pipeline) XGroupDelConsumer ¶
func (Pipeline) XGroupDestroy ¶
func (Pipeline) XGroupSetID ¶
func (Pipeline) XInfoGroups ¶
func (c Pipeline) XInfoGroups(key string) *XInfoGroupsCmd
func (Pipeline) XPending ¶
func (c Pipeline) XPending(stream, group string) *XPendingCmd
func (Pipeline) XPendingExt ¶
func (c Pipeline) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
func (Pipeline) XRange ¶
func (c Pipeline) XRange(stream, start, stop string) *XMessageSliceCmd
func (Pipeline) XRangeN ¶
func (c Pipeline) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Pipeline) XRead ¶
func (c Pipeline) XRead(a *XReadArgs) *XStreamSliceCmd
func (Pipeline) XReadGroup ¶
func (c Pipeline) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
func (Pipeline) XReadStreams ¶
func (c Pipeline) XReadStreams(streams ...string) *XStreamSliceCmd
func (Pipeline) XRevRange ¶
func (c Pipeline) XRevRange(stream, start, stop string) *XMessageSliceCmd
func (Pipeline) XRevRangeN ¶
func (c Pipeline) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Pipeline) XTrimApprox ¶
func (Pipeline) ZInterStore ¶
func (Pipeline) ZRange ¶
func (c Pipeline) ZRange(key string, start, stop int64) *StringSliceCmd
func (Pipeline) ZRangeByLex ¶
func (c Pipeline) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRangeByScore ¶
func (c Pipeline) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRangeByScoreWithScores ¶
func (Pipeline) ZRangeWithScores ¶
func (Pipeline) ZRemRangeByLex ¶
func (Pipeline) ZRemRangeByRank ¶
func (Pipeline) ZRemRangeByScore ¶
func (Pipeline) ZRevRange ¶
func (c Pipeline) ZRevRange(key string, start, stop int64) *StringSliceCmd
func (Pipeline) ZRevRangeByLex ¶
func (c Pipeline) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRevRangeByScore ¶
func (c Pipeline) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Pipeline) ZRevRangeByScoreWithScores ¶
func (Pipeline) ZRevRangeWithScores ¶
func (Pipeline) ZUnionStore ¶
type Pipeliner ¶
type Pipeliner interface { StatefulCmdable Do(args ...interface{}) *Cmd Process(cmd Cmder) error Close() error Discard() error Exec() ([]Cmder, error) ExecContext(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("mychannel1") // Wait for confirmation that subscription is created before publishing anything. _, err := pubsub.Receive() if err != nil { panic(err) } // Go channel which receives messages. ch := pubsub.Channel() // Publish a message. err = rdb.Publish("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 ¶
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 ¶
ChannelSize is like Channel, but creates a Go channel with specified buffer size.
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("mychannel2") defer pubsub.Close() for i := 0; i < 2; i++ { // ReceiveTimeout is a low level API. Use ReceiveMessage instead. msgi, err := pubsub.ReceiveTimeout(time.Second) if err != nil { break } switch msg := msgi.(type) { case *redis.Subscription: fmt.Println("subscribed to", msg.Channel) _, err := rdb.Publish("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
Output:
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.
func (*PubSub) Subscribe ¶
Subscribe the client to the specified channels. It returns empty subscription if there are no channels.
func (*PubSub) Unsubscribe ¶
Unsubscribe the client from the given channels, or from all of them if none is given.
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()
Output:
func (Ring) BRPopLPush ¶
func (Ring) BZPopMax ¶
func (c Ring) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMAX key [key ...] timeout` command.
func (Ring) BZPopMin ¶
func (c Ring) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMIN key [key ...] timeout` command.
func (Ring) BgRewriteAOF ¶
func (c Ring) BgRewriteAOF() *StatusCmd
func (Ring) BitField ¶
func (c Ring) BitField(key string, args ...interface{}) *IntSliceCmd
func (Ring) ClientGetName ¶
func (c Ring) ClientGetName() *StringCmd
ClientGetName returns the name of the connection.
func (Ring) ClientKill ¶
func (Ring) ClientKillByFilter ¶
ClientKillByFilter is new style synx, while the ClientKill is old CLIENT KILL <option> [value] ... <option> [value]
func (Ring) ClientList ¶
func (c Ring) ClientList() *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() *StatusCmd
func (Ring) ClusterForget ¶
func (Ring) ClusterGetKeysInSlot ¶
func (c Ring) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
func (Ring) ClusterInfo ¶
func (c Ring) ClusterInfo() *StringCmd
func (Ring) ClusterKeySlot ¶
func (Ring) ClusterMeet ¶
func (Ring) ClusterNodes ¶
func (c Ring) ClusterNodes() *StringCmd
func (Ring) ClusterReplicate ¶
func (Ring) ClusterResetHard ¶
func (c Ring) ClusterResetHard() *StatusCmd
func (Ring) ClusterResetSoft ¶
func (c Ring) ClusterResetSoft() *StatusCmd
func (Ring) ClusterSaveConfig ¶
func (c Ring) ClusterSaveConfig() *StatusCmd
func (Ring) ClusterSlaves ¶
func (c Ring) ClusterSlaves(nodeID string) *StringSliceCmd
func (Ring) ClusterSlots ¶
func (c Ring) ClusterSlots() *ClusterSlotsCmd
func (Ring) Command ¶
func (c Ring) Command() *CommandsInfoCmd
func (Ring) ConfigResetStat ¶
func (c Ring) ConfigResetStat() *StatusCmd
func (Ring) ConfigRewrite ¶
func (c Ring) ConfigRewrite() *StatusCmd
func (Ring) DebugObject ¶
func (Ring) FlushAllAsync ¶
func (c Ring) FlushAllAsync() *StatusCmd
func (Ring) FlushDBAsync ¶
func (c Ring) FlushDBAsync() *StatusCmd
func (*Ring) ForEachShard ¶
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(key string, geoLocation ...*GeoLocation) *IntCmd
func (Ring) GeoHash ¶
func (c Ring) GeoHash(key string, members ...string) *StringSliceCmd
func (Ring) GeoRadius ¶
func (c Ring) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Ring) GeoRadiusByMember ¶
func (c Ring) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUSBYMEMBER_RO command.
func (Ring) GeoRadiusByMemberStore ¶
func (c Ring) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Ring) GeoRadiusStore ¶
func (c Ring) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Ring) HGetAll ¶
func (c Ring) HGetAll(key string) *StringStringMapCmd
func (Ring) HIncrByFloat ¶
func (Ring) HKeys ¶
func (c Ring) HKeys(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) HMSet ¶
HMSet is like HSet, but accepts multiple values:
- HMSet("key1", "value1", "key2", "value2")
- HMSet([]string{"key1", "value1", "key2", "value2"})
- HMSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it uses HSET Redis command underneath because HMSET is deprecated.
func (Ring) HVals ¶
func (c Ring) HVals(key string) *StringSliceCmd
func (Ring) IncrByFloat ¶
func (Ring) Keys ¶
func (c Ring) Keys(pattern string) *StringSliceCmd
func (Ring) LInsertAfter ¶
func (Ring) LInsertBefore ¶
func (Ring) LRange ¶
func (c Ring) LRange(key string, start, stop int64) *StringSliceCmd
func (Ring) MSet ¶
func (c Ring) MSet(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(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(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(key string) *DurationCmd
func (Ring) PubSubChannels ¶
func (c Ring) PubSubChannels(pattern string) *StringSliceCmd
func (Ring) PubSubNumPat ¶
func (c Ring) PubSubNumPat() *IntCmd
func (Ring) PubSubNumSub ¶
func (c Ring) PubSubNumSub(channels ...string) *StringIntMapCmd
func (Ring) RestoreReplace ¶
func (Ring) SDiff ¶
func (c Ring) SDiff(keys ...string) *StringSliceCmd
func (Ring) SDiffStore ¶
func (Ring) SInter ¶
func (c Ring) SInter(keys ...string) *StringSliceCmd
func (Ring) SInterStore ¶
func (Ring) SMembers ¶
func (c Ring) SMembers(key string) *StringSliceCmd
Redis `SMEMBERS key` command output as a slice
func (Ring) SMembersMap ¶
func (c Ring) SMembersMap(key string) *StringStructMapCmd
Redis `SMEMBERS key` command output as a map
func (Ring) SPopN ¶
func (c Ring) SPopN(key string, count int64) *StringSliceCmd
Redis `SPOP key count` command.
func (Ring) SRandMember ¶
Redis `SRANDMEMBER key` command.
func (Ring) SRandMemberN ¶
func (c Ring) SRandMemberN(key string, count int64) *StringSliceCmd
Redis `SRANDMEMBER key count` command.
func (Ring) SUnion ¶
func (c Ring) SUnion(keys ...string) *StringSliceCmd
func (Ring) SUnionStore ¶
func (Ring) ScriptExists ¶
func (c Ring) ScriptExists(hashes ...string) *BoolSliceCmd
func (Ring) ScriptFlush ¶
func (c Ring) ScriptFlush() *StatusCmd
func (Ring) ScriptKill ¶
func (c Ring) ScriptKill() *StatusCmd
func (Ring) ScriptLoad ¶
func (Ring) Set ¶
Redis `SET key value [expiration]` command.
Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.
func (Ring) SetNX ¶
Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time.
func (Ring) SetXX ¶
Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time.
func (Ring) ShutdownNoSave ¶
func (c Ring) ShutdownNoSave() *StatusCmd
func (Ring) ShutdownSave ¶
func (c Ring) ShutdownSave() *StatusCmd
func (Ring) Sort ¶
func (c Ring) Sort(key string, sort *Sort) *StringSliceCmd
func (Ring) SortInterfaces ¶
func (Ring) TTL ¶
func (c Ring) TTL(key string) *DurationCmd
func (*Ring) TxPipeline ¶
func (Ring) XClaim ¶
func (c Ring) XClaim(a *XClaimArgs) *XMessageSliceCmd
func (Ring) XClaimJustID ¶
func (c Ring) XClaimJustID(a *XClaimArgs) *StringSliceCmd
func (Ring) XGroupCreate ¶
func (Ring) XGroupCreateMkStream ¶
func (Ring) XGroupDelConsumer ¶
func (Ring) XGroupDestroy ¶
func (Ring) XGroupSetID ¶
func (Ring) XInfoGroups ¶
func (c Ring) XInfoGroups(key string) *XInfoGroupsCmd
func (Ring) XPending ¶
func (c Ring) XPending(stream, group string) *XPendingCmd
func (Ring) XPendingExt ¶
func (c Ring) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
func (Ring) XRange ¶
func (c Ring) XRange(stream, start, stop string) *XMessageSliceCmd
func (Ring) XRangeN ¶
func (c Ring) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Ring) XRead ¶
func (c Ring) XRead(a *XReadArgs) *XStreamSliceCmd
func (Ring) XReadGroup ¶
func (c Ring) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
func (Ring) XReadStreams ¶
func (c Ring) XReadStreams(streams ...string) *XStreamSliceCmd
func (Ring) XRevRange ¶
func (c Ring) XRevRange(stream, start, stop string) *XMessageSliceCmd
func (Ring) XRevRangeN ¶
func (c Ring) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Ring) XTrimApprox ¶
func (Ring) ZInterStore ¶
func (Ring) ZRange ¶
func (c Ring) ZRange(key string, start, stop int64) *StringSliceCmd
func (Ring) ZRangeByLex ¶
func (c Ring) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRangeByScore ¶
func (c Ring) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRangeByScoreWithScores ¶
func (Ring) ZRangeWithScores ¶
func (Ring) ZRemRangeByLex ¶
func (Ring) ZRemRangeByRank ¶
func (Ring) ZRemRangeByScore ¶
func (Ring) ZRevRange ¶
func (c Ring) ZRevRange(key string, start, stop int64) *StringSliceCmd
func (Ring) ZRevRangeByLex ¶
func (c Ring) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRevRangeByScore ¶
func (c Ring) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Ring) ZRevRangeByScoreWithScores ¶
func (Ring) ZRevRangeWithScores ¶
func (Ring) ZUnionStore ¶
type RingOptions ¶
type RingOptions struct { // Map of name => host:port addresses of ring shards. Addrs map[string]string // Map of name => password of ring shards, to allow different shards to have // different passwords. It will be ignored if the Password field is set. Passwords map[string]string // Frequency of PING commands sent to check shards availability. // Shard is considered down after 3 subsequent failed checks. HeartbeatFrequency time.Duration // Hash function used in consistent hash. // Default is crc32.ChecksumIEEE. Hash Hash // Number of replicas in consistent hash. // Default is 100 replicas. // // Higher number of replicas will provide less deviation, that is keys will be // distributed to nodes more evenly. // // Following is deviation for common nreplicas: // -------------------------------------------------------- // | nreplicas | standard error | 99% confidence interval | // | 10 | 0.3152 | (0.37, 1.98) | // | 100 | 0.0997 | (0.76, 1.28) | // | 1000 | 0.0316 | (0.92, 1.09) | // -------------------------------------------------------- // // See https://arxiv.org/abs/1406.2294 for reference HashReplicas int // Optional hook that is called when a new shard is created. OnNewShard func(*Client) OnConnect func(*Conn) error DB int Password string MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration PoolSize int MinIdleConns int MaxConnAge time.Duration PoolTimeout time.Duration IdleTimeout time.Duration IdleCheckFrequency time.Duration }
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(0, "", 0).Iterator() for iter.Next() { fmt.Println(iter.Val()) } if err := iter.Err(); err != nil { panic(err) }
Output:
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(0, "", 0).Iterator() for iter.Next() { fmt.Println(iter.Val()) } if err := iter.Err(); err != nil { panic(err) }
Output:
func (*ScanIterator) Err ¶
func (it *ScanIterator) Err() error
Err returns the last iterator error, if any.
func (*ScanIterator) Next ¶
func (it *ScanIterator) Next() 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(rdb, []string{"xx_counter"}, 2).Result() fmt.Println(n, err) err = rdb.Set("xx_counter", "40", 0).Err() if err != nil { panic(err) } n, err = IncrByXX.Run(rdb, []string{"xx_counter"}, 2).Result() fmt.Println(n, err)
Output: <nil> redis: nil 42 <nil>
func (*Script) Exists ¶
func (s *Script) Exists(c scripter) *BoolSliceCmd
type SentinelClient ¶
type SentinelClient struct {
// contains filtered or unexported fields
}
func NewSentinelClient ¶
func NewSentinelClient(opt *Options) *SentinelClient
func (*SentinelClient) CkQuorum ¶
func (c *SentinelClient) CkQuorum(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(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() *StatusCmd
FlushConfig forces Sentinel to rewrite its configuration on disk, including the current Sentinel state.
func (*SentinelClient) GetMasterAddrByName ¶
func (c *SentinelClient) GetMasterAddrByName(name string) *StringSliceCmd
func (*SentinelClient) Master ¶
func (c *SentinelClient) Master(name string) *StringStringMapCmd
Master shows the state and info of the specified master.
func (*SentinelClient) Masters ¶
func (c *SentinelClient) Masters() *SliceCmd
Masters shows a list of monitored masters and their state.
func (*SentinelClient) Monitor ¶
func (c *SentinelClient) Monitor(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(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() *StringCmd
Ping is used to test if a connection is still alive, or to measure latency.
func (*SentinelClient) Process ¶
func (c *SentinelClient) Process(cmd Cmder) error
func (*SentinelClient) ProcessContext ¶
func (c *SentinelClient) ProcessContext(ctx context.Context, cmd Cmder) error
func (*SentinelClient) Remove ¶
func (c *SentinelClient) Remove(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(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(name string) *SliceCmd
func (*SentinelClient) Set ¶
func (c *SentinelClient) Set(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(name string) *SliceCmd
Slaves shows a list of slaves for the specified master and their state.
func (*SentinelClient) Subscribe ¶
func (c *SentinelClient) Subscribe(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 SliceCmd ¶
type SliceCmd struct {
// contains filtered or unexported fields
}
func NewSliceCmd ¶
func NewSliceCmd(args ...interface{}) *SliceCmd
func NewSliceResult ¶
NewSliceResult returns a SliceCmd initialised with val and err for testing
type StatefulCmdable ¶
type StatusCmd ¶
type StatusCmd struct {
// contains filtered or unexported fields
}
func NewStatusCmd ¶
func NewStatusCmd(args ...interface{}) *StatusCmd
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 NewStringCmd(args ...interface{}) *StringCmd
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(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(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(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) 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(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 NewTimeCmd(args ...interface{}) *TimeCmd
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) BRPopLPush ¶
func (Tx) BZPopMax ¶
func (c Tx) BZPopMax(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMAX key [key ...] timeout` command.
func (Tx) BZPopMin ¶
func (c Tx) BZPopMin(timeout time.Duration, keys ...string) *ZWithKeyCmd
Redis `BZPOPMIN key [key ...] timeout` command.
func (Tx) BgRewriteAOF ¶
func (c Tx) BgRewriteAOF() *StatusCmd
func (Tx) BitField ¶
func (c Tx) BitField(key string, args ...interface{}) *IntSliceCmd
func (Tx) ClientGetName ¶
func (c Tx) ClientGetName() *StringCmd
ClientGetName returns the name of the connection.
func (Tx) ClientKill ¶
func (Tx) ClientKillByFilter ¶
ClientKillByFilter is new style synx, while the ClientKill is old CLIENT KILL <option> [value] ... <option> [value]
func (Tx) ClientList ¶
func (c Tx) ClientList() *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() *StatusCmd
func (Tx) ClusterForget ¶
func (Tx) ClusterGetKeysInSlot ¶
func (c Tx) ClusterGetKeysInSlot(slot int, count int) *StringSliceCmd
func (Tx) ClusterInfo ¶
func (c Tx) ClusterInfo() *StringCmd
func (Tx) ClusterKeySlot ¶
func (Tx) ClusterMeet ¶
func (Tx) ClusterNodes ¶
func (c Tx) ClusterNodes() *StringCmd
func (Tx) ClusterReplicate ¶
func (Tx) ClusterResetHard ¶
func (c Tx) ClusterResetHard() *StatusCmd
func (Tx) ClusterResetSoft ¶
func (c Tx) ClusterResetSoft() *StatusCmd
func (Tx) ClusterSaveConfig ¶
func (c Tx) ClusterSaveConfig() *StatusCmd
func (Tx) ClusterSlaves ¶
func (c Tx) ClusterSlaves(nodeID string) *StringSliceCmd
func (Tx) ClusterSlots ¶
func (c Tx) ClusterSlots() *ClusterSlotsCmd
func (Tx) Command ¶
func (c Tx) Command() *CommandsInfoCmd
func (Tx) ConfigResetStat ¶
func (c Tx) ConfigResetStat() *StatusCmd
func (Tx) ConfigRewrite ¶
func (c Tx) ConfigRewrite() *StatusCmd
func (Tx) DebugObject ¶
func (Tx) FlushAllAsync ¶
func (c Tx) FlushAllAsync() *StatusCmd
func (Tx) FlushDBAsync ¶
func (c Tx) FlushDBAsync() *StatusCmd
func (Tx) GeoAdd ¶
func (c Tx) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd
func (Tx) GeoHash ¶
func (c Tx) GeoHash(key string, members ...string) *StringSliceCmd
func (Tx) GeoRadius ¶
func (c Tx) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUS_RO command.
func (Tx) GeoRadiusByMember ¶
func (c Tx) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd
GeoRadius is a read-only GEORADIUSBYMEMBER_RO command.
func (Tx) GeoRadiusByMemberStore ¶
func (c Tx) GeoRadiusByMemberStore(key, member string, query *GeoRadiusQuery) *IntCmd
GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
func (Tx) GeoRadiusStore ¶
func (c Tx) GeoRadiusStore(key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
GeoRadiusStore is a writing GEORADIUS command.
func (Tx) HGetAll ¶
func (c Tx) HGetAll(key string) *StringStringMapCmd
func (Tx) HIncrByFloat ¶
func (Tx) HKeys ¶
func (c Tx) HKeys(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) HMSet ¶
HMSet is like HSet, but accepts multiple values:
- HMSet("key1", "value1", "key2", "value2")
- HMSet([]string{"key1", "value1", "key2", "value2"})
- HMSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
Note that it uses HSET Redis command underneath because HMSET is deprecated.
func (Tx) HVals ¶
func (c Tx) HVals(key string) *StringSliceCmd
func (Tx) IncrByFloat ¶
func (Tx) Keys ¶
func (c Tx) Keys(pattern string) *StringSliceCmd
func (Tx) LInsertAfter ¶
func (Tx) LInsertBefore ¶
func (Tx) LRange ¶
func (c Tx) LRange(key string, start, stop int64) *StringSliceCmd
func (Tx) MSet ¶
func (c Tx) MSet(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(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(key string) *DurationCmd
func (Tx) ObjectRefCount ¶
func (Tx) PTTL ¶
func (c Tx) PTTL(key string) *DurationCmd
func (Tx) PubSubChannels ¶
func (c Tx) PubSubChannels(pattern string) *StringSliceCmd
func (Tx) PubSubNumPat ¶
func (c Tx) PubSubNumPat() *IntCmd
func (Tx) PubSubNumSub ¶
func (c Tx) PubSubNumSub(channels ...string) *StringIntMapCmd
func (Tx) RestoreReplace ¶
func (Tx) SDiff ¶
func (c Tx) SDiff(keys ...string) *StringSliceCmd
func (Tx) SDiffStore ¶
func (Tx) SInter ¶
func (c Tx) SInter(keys ...string) *StringSliceCmd
func (Tx) SInterStore ¶
func (Tx) SMembers ¶
func (c Tx) SMembers(key string) *StringSliceCmd
Redis `SMEMBERS key` command output as a slice
func (Tx) SMembersMap ¶
func (c Tx) SMembersMap(key string) *StringStructMapCmd
Redis `SMEMBERS key` command output as a map
func (Tx) SPopN ¶
func (c Tx) SPopN(key string, count int64) *StringSliceCmd
Redis `SPOP key count` command.
func (Tx) SRandMember ¶
Redis `SRANDMEMBER key` command.
func (Tx) SRandMemberN ¶
func (c Tx) SRandMemberN(key string, count int64) *StringSliceCmd
Redis `SRANDMEMBER key count` command.
func (Tx) SUnion ¶
func (c Tx) SUnion(keys ...string) *StringSliceCmd
func (Tx) SUnionStore ¶
func (Tx) ScriptExists ¶
func (c Tx) ScriptExists(hashes ...string) *BoolSliceCmd
func (Tx) ScriptFlush ¶
func (c Tx) ScriptFlush() *StatusCmd
func (Tx) ScriptKill ¶
func (c Tx) ScriptKill() *StatusCmd
func (Tx) ScriptLoad ¶
func (Tx) Set ¶
Redis `SET key value [expiration]` command.
Use expiration for `SETEX`-like behavior. Zero expiration means the key has no expiration time.
func (Tx) SetNX ¶
Redis `SET key value [expiration] NX` command.
Zero expiration means the key has no expiration time.
func (Tx) SetXX ¶
Redis `SET key value [expiration] XX` command.
Zero expiration means the key has no expiration time.
func (Tx) ShutdownNoSave ¶
func (c Tx) ShutdownNoSave() *StatusCmd
func (Tx) ShutdownSave ¶
func (c Tx) ShutdownSave() *StatusCmd
func (Tx) Sort ¶
func (c Tx) Sort(key string, sort *Sort) *StringSliceCmd
func (Tx) SortInterfaces ¶
func (Tx) TTL ¶
func (c Tx) TTL(key string) *DurationCmd
func (*Tx) TxPipeline ¶
TxPipeline creates a new pipeline. Usually it is more convenient to use TxPipelined.
func (*Tx) TxPipelined ¶
TxPipelined executes commands queued in the fn in a 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) XClaim ¶
func (c Tx) XClaim(a *XClaimArgs) *XMessageSliceCmd
func (Tx) XClaimJustID ¶
func (c Tx) XClaimJustID(a *XClaimArgs) *StringSliceCmd
func (Tx) XGroupCreate ¶
func (Tx) XGroupCreateMkStream ¶
func (Tx) XGroupDelConsumer ¶
func (Tx) XGroupDestroy ¶
func (Tx) XGroupSetID ¶
func (Tx) XInfoGroups ¶
func (c Tx) XInfoGroups(key string) *XInfoGroupsCmd
func (Tx) XPending ¶
func (c Tx) XPending(stream, group string) *XPendingCmd
func (Tx) XPendingExt ¶
func (c Tx) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd
func (Tx) XRange ¶
func (c Tx) XRange(stream, start, stop string) *XMessageSliceCmd
func (Tx) XRangeN ¶
func (c Tx) XRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Tx) XRead ¶
func (c Tx) XRead(a *XReadArgs) *XStreamSliceCmd
func (Tx) XReadGroup ¶
func (c Tx) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd
func (Tx) XReadStreams ¶
func (c Tx) XReadStreams(streams ...string) *XStreamSliceCmd
func (Tx) XRevRange ¶
func (c Tx) XRevRange(stream, start, stop string) *XMessageSliceCmd
func (Tx) XRevRangeN ¶
func (c Tx) XRevRangeN(stream, start, stop string, count int64) *XMessageSliceCmd
func (Tx) XTrimApprox ¶
func (Tx) ZInterStore ¶
func (Tx) ZRange ¶
func (c Tx) ZRange(key string, start, stop int64) *StringSliceCmd
func (Tx) ZRangeByLex ¶
func (c Tx) ZRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRangeByScore ¶
func (c Tx) ZRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRangeByScoreWithScores ¶
func (Tx) ZRangeWithScores ¶
func (Tx) ZRemRangeByLex ¶
func (Tx) ZRemRangeByRank ¶
func (Tx) ZRemRangeByScore ¶
func (Tx) ZRevRange ¶
func (c Tx) ZRevRange(key string, start, stop int64) *StringSliceCmd
func (Tx) ZRevRangeByLex ¶
func (c Tx) ZRevRangeByLex(key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRevRangeByScore ¶
func (c Tx) ZRevRangeByScore(key string, opt *ZRangeBy) *StringSliceCmd
func (Tx) ZRevRangeByScoreWithScores ¶
func (Tx) ZRevRangeWithScores ¶
func (Tx) ZUnionStore ¶
type UniversalClient ¶
type UniversalClient interface { Cmdable Context() context.Context AddHook(Hook) Watch(fn func(*Tx) error, keys ...string) error Do(args ...interface{}) *Cmd DoContext(ctx context.Context, args ...interface{}) *Cmd Process(cmd Cmder) error ProcessContext(ctx context.Context, cmd Cmder) error Subscribe(channels ...string) *PubSub PSubscribe(channels ...string) *PubSub Close() error }
UniversalClient is an abstract client which - based on the provided options - can connect to either clusters, or sentinel-backed failover instances or simple single-instance servers. This can be useful for testing cluster-specific applications locally.
func NewUniversalClient ¶
func NewUniversalClient(opts *UniversalOptions) UniversalClient
NewUniversalClient returns a new multi client. The type of client returned depends on the following three conditions:
1. if a MasterName is passed a sentinel-backed FailoverClient will be returned 2. if the number of Addrs is two or more, a ClusterClient will be returned 3. otherwise, a single-node redis Client will be returned.
Example (Cluster) ¶
rdb := redis.NewUniversalClient(&redis.UniversalOptions{ Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"}, }) defer rdb.Close() rdb.Ping()
Output:
Example (Failover) ¶
rdb := redis.NewUniversalClient(&redis.UniversalOptions{ MasterName: "master", Addrs: []string{":26379"}, }) defer rdb.Close() rdb.Ping()
Output:
Example (Simple) ¶
rdb := redis.NewUniversalClient(&redis.UniversalOptions{ Addrs: []string{":6379"}, }) defer rdb.Close() rdb.Ping()
Output:
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(*Conn) error Password string MaxRetries int MinRetryBackoff time.Duration MaxRetryBackoff time.Duration DialTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration 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 // The sentinel master name. // Only failover clients. MasterName string }
UniversalOptions information is required by UniversalClient to establish connections.
type XClaimArgs ¶
type XInfoGroups ¶
type XInfoGroupsCmd ¶
type XInfoGroupsCmd struct {
// contains filtered or unexported fields
}
func NewXInfoGroupsCmd ¶
func NewXInfoGroupsCmd(stream string) *XInfoGroupsCmd
func (*XInfoGroupsCmd) Result ¶
func (cmd *XInfoGroupsCmd) Result() ([]XInfoGroups, error)
func (*XInfoGroupsCmd) String ¶
func (cmd *XInfoGroupsCmd) String() string
func (*XInfoGroupsCmd) Val ¶
func (cmd *XInfoGroupsCmd) Val() []XInfoGroups
type XMessageSliceCmd ¶
type XMessageSliceCmd struct {
// contains filtered or unexported fields
}
func NewXMessageSliceCmd ¶
func NewXMessageSliceCmd(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(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(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(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 ZSliceCmd ¶
type ZSliceCmd struct {
// contains filtered or unexported fields
}
func NewZSliceCmd ¶
func NewZSliceCmd(args ...interface{}) *ZSliceCmd
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(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