Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv9.

redis

packagemodule
v6.15.9+incompatibleLatest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2020 License:BSD-2-ClauseImports:25Imported by:10,091

Details

Repository

github.com/go-redis/redis

Links

README

Redis client for Golang

Build StatusGoDocAirbrake

Supports:

API docs:https://godoc.org/github.com/go-redis/redis.Examples:https://godoc.org/github.com/go-redis/redis#pkg-examples.

Installation

Install:

go get -u github.com/go-redis/redis

Import:

import "github.com/go-redis/redis"

Quickstart

func ExampleNewClient() {client := redis.NewClient(&redis.Options{Addr:     "localhost:6379",Password: "", // no password setDB:       0,  // use default DB})pong, err := client.Ping().Result()fmt.Println(pong, err)// Output: PONG <nil>}func ExampleClient() {err := client.Set("key", "value", 0).Err()if err != nil {panic(err)}val, err := client.Get("key").Result()if err != nil {panic(err)}fmt.Println("key", val)val2, err := client.Get("key2").Result()if err == redis.Nil {fmt.Println("key2 does not exist")} else if err != nil {panic(err)} else {fmt.Println("key2", val2)}// Output: key value// key2 does not exist}

Howto

Please go throughexamples to get an idea how to use this package.

Look and feel

Some corner cases:

// SET key value EX 10 NXset, err := client.SetNX("key", "value", 10*time.Second).Result()// SORT list LIMIT 0 2 ASCvals, err := client.Sort("list", redis.Sort{Offset: 0, Count: 2, Order: "ASC"}).Result()// ZRANGEBYSCORE zset -inf +inf WITHSCORES LIMIT 0 2vals, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeBy{Min: "-inf",Max: "+inf",Offset: 0,Count: 2,}).Result()// ZINTERSTORE out 2 zset1 zset2 WEIGHTS 2 3 AGGREGATE SUMvals, err := client.ZInterStore("out", redis.ZStore{Weights: []int64{2, 3}}, "zset1", "zset2").Result()// EVAL "return {KEYS[1],ARGV[1]}" 1 "key" "hello"vals, err := client.Eval("return {KEYS[1],ARGV[1]}", []string{"key"}, "hello").Result()

Benchmark

go-redis vs redigo:

BenchmarkSetGoRedis10Conns64Bytes-4   200000      7621 ns/op     210 B/op       6 allocs/opBenchmarkSetGoRedis100Conns64Bytes-4  200000      7554 ns/op     210 B/op       6 allocs/opBenchmarkSetGoRedis10Conns1KB-4       200000      7697 ns/op     210 B/op       6 allocs/opBenchmarkSetGoRedis100Conns1KB-4      200000      7688 ns/op     210 B/op       6 allocs/opBenchmarkSetGoRedis10Conns10KB-4      200000      9214 ns/op     210 B/op       6 allocs/opBenchmarkSetGoRedis100Conns10KB-4     200000      9181 ns/op     210 B/op       6 allocs/opBenchmarkSetGoRedis10Conns1MB-4         2000    583242 ns/op    2337 B/op       6 allocs/opBenchmarkSetGoRedis100Conns1MB-4        2000    583089 ns/op    2338 B/op       6 allocs/opBenchmarkSetRedigo10Conns64Bytes-4    200000      7576 ns/op     208 B/op       7 allocs/opBenchmarkSetRedigo100Conns64Bytes-4   200000      7782 ns/op     208 B/op       7 allocs/opBenchmarkSetRedigo10Conns1KB-4        200000      7958 ns/op     208 B/op       7 allocs/opBenchmarkSetRedigo100Conns1KB-4       200000      7725 ns/op     208 B/op       7 allocs/opBenchmarkSetRedigo10Conns10KB-4       100000     18442 ns/op     208 B/op       7 allocs/opBenchmarkSetRedigo100Conns10KB-4      100000     18818 ns/op     208 B/op       7 allocs/opBenchmarkSetRedigo10Conns1MB-4          2000    668829 ns/op     226 B/op       7 allocs/opBenchmarkSetRedigo100Conns1MB-4         2000    679542 ns/op     226 B/op       7 allocs/op

Redis Cluster:

BenchmarkRedisPing-4                  200000      6983 ns/op     116 B/op       4 allocs/opBenchmarkRedisClusterPing-4           100000     11535 ns/op     117 B/op       4 allocs/op

See also

Documentation

Overview

Package redis implements a Redis client.

Example (CustomCommand)
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {Get := func(redisdb *redis.Client, key string) *redis.StringCmd {cmd := redis.NewStringCmd("get", key)redisdb.Process(cmd)return cmd}v, err := Get(redisdb, "key_does_not_exist").Result()fmt.Printf("%q %s", v, err)}
Output:"" redis: nil

Example (CustomCommand2)
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {v, err := redisdb.Do("get", "key_does_not_exist").String()fmt.Printf("%q %s", v, err)}
Output:"" redis: nil

Example (Instrumentation)
package mainimport ("fmt""github.com/go-redis/redis")func main() {redisdb := redis.NewClient(&redis.Options{Addr: ":6379",})redisdb.WrapProcess(func(old func(cmd redis.Cmder) error) func(cmd redis.Cmder) error {return func(cmd redis.Cmder) error {fmt.Printf("starting processing: <%s>\n", cmd)err := old(cmd)fmt.Printf("finished processing: <%s>\n", cmd)return err}})redisdb.Ping()}
Output:starting processing: <ping: >finished processing: <ping: PONG>

Index

Examples

Constants

Nil reply Redis returns when key does not exist.

View Source
const TxFailedErr =proto.RedisError("redis: transaction failed")

TxFailedErr transaction redis failed.

Variables

This section is empty.

Functions

funcSetLogger

func SetLogger(logger *log.Logger)

Types

typeBitCount

type BitCount struct {Start, Endint64}

typeBoolCmd

type BoolCmd struct {// contains filtered or unexported fields}

funcNewBoolCmd

func NewBoolCmd(args ...interface{}) *BoolCmd

funcNewBoolResult

func NewBoolResult(valbool, errerror) *BoolCmd

NewBoolResult returns a BoolCmd initialised with val and err for testing

func (*BoolCmd)Args

func (cmd *BoolCmd) Args() []interface{}

func (*BoolCmd)Err

func (cmd *BoolCmd) Err()error

func (*BoolCmd)Name

func (cmd *BoolCmd) Name()string

func (*BoolCmd)Result

func (cmd *BoolCmd) Result() (bool,error)

func (*BoolCmd)String

func (cmd *BoolCmd) String()string

func (*BoolCmd)Val

func (cmd *BoolCmd) Val()bool

typeBoolSliceCmd

type BoolSliceCmd struct {// contains filtered or unexported fields}

funcNewBoolSliceCmd

func NewBoolSliceCmd(args ...interface{}) *BoolSliceCmd

funcNewBoolSliceResult

func NewBoolSliceResult(val []bool, errerror) *BoolSliceCmd

NewBoolSliceResult returns a BoolSliceCmd initialised with val and err for testing

func (*BoolSliceCmd)Args

func (cmd *BoolSliceCmd) Args() []interface{}

func (*BoolSliceCmd)Err

func (cmd *BoolSliceCmd) Err()error

func (*BoolSliceCmd)Name

func (cmd *BoolSliceCmd) Name()string

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

typeClient

type Client struct {// contains filtered or unexported fields}

Client is a Redis client representing a pool of zero or moreunderlying connections. It's safe for concurrent use by multiplegoroutines.

Example
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {err := redisdb.Set("key", "value", 0).Err()if err != nil {panic(err)}val, err := redisdb.Get("key").Result()if err != nil {panic(err)}fmt.Println("key", val)val2, err := redisdb.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 valuemissing_key does not exist

funcNewClient

func NewClient(opt *Options) *Client

NewClient returns a client to the Redis Server specified by Options.

Example
package mainimport ("fmt""github.com/go-redis/redis")func main() {redisdb := redis.NewClient(&redis.Options{Addr:     "localhost:6379", // use default AddrPassword: "",               // no password setDB:       0,                // use default DB})pong, err := redisdb.Ping().Result()fmt.Println(pong, err)}
Output:PONG <nil>

funcNewFailoverClient

func NewFailoverClient(failoverOpt *FailoverOptions) *Client

NewFailoverClient returns a Redis client that uses Redis Sentinelfor automatic failover. It's safe for concurrent use by multiplegoroutines.

Example
package mainimport ("github.com/go-redis/redis")func main() {// See http://redis.io/topics/sentinel for instructions how to// setup Redis Sentinel.redisdb := redis.NewFailoverClient(&redis.FailoverOptions{MasterName:    "master",SentinelAddrs: []string{":26379"},})redisdb.Ping()}

func (*Client)Append

func (c *Client) Append(key, valuestring) *IntCmd

func (*Client)BLPop

func (c *Client) BLPop(timeouttime.Duration, keys ...string) *StringSliceCmd
Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {if err := redisdb.RPush("queue", "message").Err(); err != nil {panic(err)}// use `redisdb.BLPop(0, "queue")` for infinite waiting timeresult, err := redisdb.BLPop(1*time.Second, "queue").Result()if err != nil {panic(err)}fmt.Println(result[0], result[1])}
Output:queue message

func (*Client)BRPop

func (c *Client) BRPop(timeouttime.Duration, keys ...string) *StringSliceCmd

func (*Client)BRPopLPush

func (c *Client) BRPopLPush(source, destinationstring, timeouttime.Duration) *StringCmd

func (*Client)BZPopMax

func (c *Client) BZPopMax(timeouttime.Duration, keys ...string) *ZWithKeyCmd

Redis `BZPOPMAX key [key ...] timeout` command.

func (*Client)BZPopMin

func (c *Client) BZPopMin(timeouttime.Duration, keys ...string) *ZWithKeyCmd

Redis `BZPOPMIN key [key ...] timeout` command.

func (*Client)BgRewriteAOF

func (c *Client) BgRewriteAOF() *StatusCmd

func (*Client)BgSave

func (c *Client) BgSave() *StatusCmd

func (*Client)BitCount

func (c *Client) BitCount(keystring, bitCount *BitCount) *IntCmd

func (*Client)BitOpAnd

func (c *Client) BitOpAnd(destKeystring, keys ...string) *IntCmd

func (*Client)BitOpNot

func (c *Client) BitOpNot(destKeystring, keystring) *IntCmd

func (*Client)BitOpOr

func (c *Client) BitOpOr(destKeystring, keys ...string) *IntCmd

func (*Client)BitOpXor

func (c *Client) BitOpXor(destKeystring, keys ...string) *IntCmd

func (*Client)BitPos

func (c *Client) BitPos(keystring, bitint64, pos ...int64) *IntCmd

func (*Client)ClientGetName

func (c *Client) ClientGetName() *StringCmd

ClientGetName returns the name of the connection.

func (*Client)ClientID

func (c *Client) ClientID() *IntCmd

func (*Client)ClientKill

func (c *Client) ClientKill(ipPortstring) *StatusCmd

func (*Client)ClientKillByFilter

func (c *Client) ClientKillByFilter(keys ...string) *IntCmd

ClientKillByFilter is new style synx, while the ClientKill is oldCLIENT KILL <option> [value] ... <option> [value]

func (*Client)ClientList

func (c *Client) ClientList() *StringCmd

func (*Client)ClientPause

func (c *Client) ClientPause(durtime.Duration) *BoolCmd

func (*Client)ClientUnblock

func (c *Client) ClientUnblock(idint64) *IntCmd

func (*Client)ClientUnblockWithError

func (c *Client) ClientUnblockWithError(idint64) *IntCmd

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 belong-lived and shared between many goroutines.

func (*Client)ClusterAddSlots

func (c *Client) ClusterAddSlots(slots ...int) *StatusCmd

func (*Client)ClusterAddSlotsRange

func (c *Client) ClusterAddSlotsRange(min, maxint) *StatusCmd

func (*Client)ClusterCountFailureReports

func (c *Client) ClusterCountFailureReports(nodeIDstring) *IntCmd

func (*Client)ClusterCountKeysInSlot

func (c *Client) ClusterCountKeysInSlot(slotint) *IntCmd

func (*Client)ClusterDelSlots

func (c *Client) ClusterDelSlots(slots ...int) *StatusCmd

func (*Client)ClusterDelSlotsRange

func (c *Client) ClusterDelSlotsRange(min, maxint) *StatusCmd

func (*Client)ClusterFailover

func (c *Client) ClusterFailover() *StatusCmd

func (*Client)ClusterForget

func (c *Client) ClusterForget(nodeIDstring) *StatusCmd

func (*Client)ClusterGetKeysInSlot

func (c *Client) ClusterGetKeysInSlot(slotint, countint) *StringSliceCmd

func (*Client)ClusterInfo

func (c *Client) ClusterInfo() *StringCmd

func (*Client)ClusterKeySlot

func (c *Client) ClusterKeySlot(keystring) *IntCmd

func (*Client)ClusterMeet

func (c *Client) ClusterMeet(host, portstring) *StatusCmd

func (*Client)ClusterNodes

func (c *Client) ClusterNodes() *StringCmd

func (*Client)ClusterReplicate

func (c *Client) ClusterReplicate(nodeIDstring) *StatusCmd

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(nodeIDstring) *StringSliceCmd

func (*Client)ClusterSlots

func (c *Client) ClusterSlots() *ClusterSlotsCmd

func (*Client)Command

func (c *Client) Command() *CommandsInfoCmd

func (*Client)ConfigGet

func (c *Client) ConfigGet(parameterstring) *SliceCmd

func (*Client)ConfigResetStat

func (c *Client) ConfigResetStat() *StatusCmd

func (*Client)ConfigRewrite

func (c *Client) ConfigRewrite() *StatusCmd

func (*Client)ConfigSet

func (c *Client) ConfigSet(parameter, valuestring) *StatusCmd

func (*Client)Context

func (c *Client) Context()context.Context

func (*Client)DBSize

func (c *Client) DBSize() *IntCmd

func (*Client)DbSize

func (c *Client) DbSize() *IntCmd

Deperecated. Use DBSize instead.

func (*Client)DebugObject

func (c *Client) DebugObject(keystring) *StringCmd

func (*Client)Decr

func (c *Client) Decr(keystring) *IntCmd

func (*Client)DecrBy

func (c *Client) DecrBy(keystring, decrementint64) *IntCmd

func (*Client)Del

func (c *Client) Del(keys ...string) *IntCmd

func (*Client)Do

func (c *Client) Do(args ...interface{}) *Cmd

Do creates a Cmd from the args and processes the cmd.

func (*Client)Dump

func (c *Client) Dump(keystring) *StringCmd

func (*Client)Echo

func (c *Client) Echo(message interface{}) *StringCmd

func (*Client)Eval

func (c *Client) Eval(scriptstring, keys []string, args ...interface{}) *Cmd

func (*Client)EvalSha

func (c *Client) EvalSha(sha1string, keys []string, args ...interface{}) *Cmd

func (*Client)Exists

func (c *Client) Exists(keys ...string) *IntCmd

func (*Client)Expire

func (c *Client) Expire(keystring, expirationtime.Duration) *BoolCmd

func (*Client)ExpireAt

func (c *Client) ExpireAt(keystring, tmtime.Time) *BoolCmd

func (*Client)FlushAll

func (c *Client) FlushAll() *StatusCmd

func (*Client)FlushAllAsync

func (c *Client) FlushAllAsync() *StatusCmd

func (*Client)FlushDB

func (c *Client) FlushDB() *StatusCmd

func (*Client)FlushDBAsync

func (c *Client) FlushDBAsync() *StatusCmd

func (*Client)FlushDb

func (c *Client) FlushDb() *StatusCmd

Deprecated. Use FlushDB instead.

func (*Client)GeoAdd

func (c *Client) GeoAdd(keystring, geoLocation ...*GeoLocation) *IntCmd

func (*Client)GeoDist

func (c *Client) GeoDist(keystring, member1, member2, unitstring) *FloatCmd

func (*Client)GeoHash

func (c *Client) GeoHash(keystring, members ...string) *StringSliceCmd

func (*Client)GeoPos

func (c *Client) GeoPos(keystring, members ...string) *GeoPosCmd

func (*Client)GeoRadius

func (c *Client) GeoRadius(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Client)GeoRadiusByMember

func (c *Client) GeoRadiusByMember(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmd

func (*Client)GeoRadiusByMemberRO

func (c *Client) GeoRadiusByMemberRO(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmd

func (*Client)GeoRadiusRO

func (c *Client) GeoRadiusRO(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Client)Get

func (c *Client) Get(keystring) *StringCmd

Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (*Client)GetBit

func (c *Client) GetBit(keystring, offsetint64) *IntCmd

func (*Client)GetRange

func (c *Client) GetRange(keystring, start, endint64) *StringCmd

func (*Client)GetSet

func (c *Client) GetSet(keystring, value interface{}) *StringCmd

func (*Client)HDel

func (c *Client) HDel(keystring, fields ...string) *IntCmd

func (*Client)HExists

func (c *Client) HExists(key, fieldstring) *BoolCmd

func (*Client)HGet

func (c *Client) HGet(key, fieldstring) *StringCmd

func (*Client)HGetAll

func (c *Client) HGetAll(keystring) *StringStringMapCmd

func (*Client)HIncrBy

func (c *Client) HIncrBy(key, fieldstring, incrint64) *IntCmd

func (*Client)HIncrByFloat

func (c *Client) HIncrByFloat(key, fieldstring, incrfloat64) *FloatCmd

func (*Client)HKeys

func (c *Client) HKeys(keystring) *StringSliceCmd

func (*Client)HLen

func (c *Client) HLen(keystring) *IntCmd

func (*Client)HMGet

func (c *Client) HMGet(keystring, fields ...string) *SliceCmd

func (*Client)HMSet

func (c *Client) HMSet(keystring, fields map[string]interface{}) *StatusCmd

func (*Client)HScan

func (c *Client) HScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*Client)HSet

func (c *Client) HSet(key, fieldstring, value interface{}) *BoolCmd

func (*Client)HSetNX

func (c *Client) HSetNX(key, fieldstring, value interface{}) *BoolCmd

func (*Client)HVals

func (c *Client) HVals(keystring) *StringSliceCmd

func (*Client)Incr

func (c *Client) Incr(keystring) *IntCmd
Example
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {result, err := redisdb.Incr("counter").Result()if err != nil {panic(err)}fmt.Println(result)}
Output:1

func (*Client)IncrBy

func (c *Client) IncrBy(keystring, valueint64) *IntCmd

func (*Client)IncrByFloat

func (c *Client) IncrByFloat(keystring, valuefloat64) *FloatCmd

func (*Client)Info

func (c *Client) Info(section ...string) *StringCmd

func (*Client)Keys

func (c *Client) Keys(patternstring) *StringSliceCmd

func (*Client)LIndex

func (c *Client) LIndex(keystring, indexint64) *StringCmd

func (*Client)LInsert

func (c *Client) LInsert(key, opstring, pivot, value interface{}) *IntCmd

func (*Client)LInsertAfter

func (c *Client) LInsertAfter(keystring, pivot, value interface{}) *IntCmd

func (*Client)LInsertBefore

func (c *Client) LInsertBefore(keystring, pivot, value interface{}) *IntCmd

func (*Client)LLen

func (c *Client) LLen(keystring) *IntCmd

func (*Client)LPop

func (c *Client) LPop(keystring) *StringCmd

func (*Client)LPush

func (c *Client) LPush(keystring, values ...interface{}) *IntCmd

func (*Client)LPushX

func (c *Client) LPushX(keystring, value interface{}) *IntCmd

func (*Client)LRange

func (c *Client) LRange(keystring, start, stopint64) *StringSliceCmd

func (*Client)LRem

func (c *Client) LRem(keystring, countint64, value interface{}) *IntCmd

func (*Client)LSet

func (c *Client) LSet(keystring, indexint64, value interface{}) *StatusCmd

func (*Client)LTrim

func (c *Client) LTrim(keystring, start, stopint64) *StatusCmd

func (*Client)LastSave

func (c *Client) LastSave() *IntCmd

func (*Client)MGet

func (c *Client) MGet(keys ...string) *SliceCmd

func (*Client)MSet

func (c *Client) MSet(pairs ...interface{}) *StatusCmd

func (*Client)MSetNX

func (c *Client) MSetNX(pairs ...interface{}) *BoolCmd

func (*Client)MemoryUsage

func (c *Client) MemoryUsage(keystring, samples ...int) *IntCmd

func (*Client)Migrate

func (c *Client) Migrate(host, port, keystring, dbint64, timeouttime.Duration) *StatusCmd

func (*Client)Move

func (c *Client) Move(keystring, dbint64) *BoolCmd

func (*Client)ObjectEncoding

func (c *Client) ObjectEncoding(keystring) *StringCmd

func (*Client)ObjectIdleTime

func (c *Client) ObjectIdleTime(keystring) *DurationCmd

func (*Client)ObjectRefCount

func (c *Client) ObjectRefCount(keystring) *IntCmd

func (*Client)Options

func (c *Client) Options() *Options

Options returns read-only Options that were used to create the client.

func (*Client)PExpire

func (c *Client) PExpire(keystring, expirationtime.Duration) *BoolCmd

func (*Client)PExpireAt

func (c *Client) PExpireAt(keystring, tmtime.Time) *BoolCmd

func (*Client)PFAdd

func (c *Client) PFAdd(keystring, els ...interface{}) *IntCmd

func (*Client)PFCount

func (c *Client) PFCount(keys ...string) *IntCmd

func (*Client)PFMerge

func (c *Client) PFMerge(deststring, keys ...string) *StatusCmd

func (*Client)PSubscribe

func (c *Client) PSubscribe(channels ...string) *PubSub

PSubscribe subscribes the client to the given patterns.Patterns can be omitted to create empty subscription.

func (*Client)PTTL

func (c *Client) PTTL(keystring) *DurationCmd

func (*Client)Persist

func (c *Client) Persist(keystring) *BoolCmd

func (*Client)Ping

func (c *Client) Ping() *StatusCmd

func (*Client)Pipeline

func (c *Client) Pipeline()Pipeliner
Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {pipe := redisdb.Pipeline()incr := pipe.Incr("pipeline_counter")pipe.Expire("pipeline_counter", time.Hour)// Execute////     INCR pipeline_counter//     EXPIRE pipeline_counts 3600//// using one redisdb-server roundtrip._, err := pipe.Exec()fmt.Println(incr.Val(), err)}
Output:1 <nil>

func (*Client)Pipelined

func (c *Client) Pipelined(fn func(Pipeliner)error) ([]Cmder,error)
Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {var incr *redis.IntCmd_, err := redisdb.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)PoolStats

func (c *Client) PoolStats() *PoolStats

PoolStats returns connection pool stats.

func (*Client)Process

func (c *Client) Process(cmdCmder)error

func (*Client)PubSubChannels

func (c *Client) PubSubChannels(patternstring) *StringSliceCmd

func (*Client)PubSubNumPat

func (c *Client) PubSubNumPat() *IntCmd

func (*Client)PubSubNumSub

func (c *Client) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*Client)Publish

func (c *Client) Publish(channelstring, message interface{}) *IntCmd

Publish posts the message to the channel.

func (*Client)Quit

func (c *Client) Quit() *StatusCmd

func (*Client)RPop

func (c *Client) RPop(keystring) *StringCmd

func (*Client)RPopLPush

func (c *Client) RPopLPush(source, destinationstring) *StringCmd

func (*Client)RPush

func (c *Client) RPush(keystring, values ...interface{}) *IntCmd

func (*Client)RPushX

func (c *Client) RPushX(keystring, value interface{}) *IntCmd

func (*Client)RandomKey

func (c *Client) RandomKey() *StringCmd

func (*Client)ReadOnly

func (c *Client) ReadOnly() *StatusCmd

func (*Client)ReadWrite

func (c *Client) ReadWrite() *StatusCmd

func (*Client)Rename

func (c *Client) Rename(key, newkeystring) *StatusCmd

func (*Client)RenameNX

func (c *Client) RenameNX(key, newkeystring) *BoolCmd

func (*Client)Restore

func (c *Client) Restore(keystring, ttltime.Duration, valuestring) *StatusCmd

func (*Client)RestoreReplace

func (c *Client) RestoreReplace(keystring, ttltime.Duration, valuestring) *StatusCmd

func (*Client)SAdd

func (c *Client) SAdd(keystring, members ...interface{}) *IntCmd

func (*Client)SCard

func (c *Client) SCard(keystring) *IntCmd

func (*Client)SDiff

func (c *Client) SDiff(keys ...string) *StringSliceCmd

func (*Client)SDiffStore

func (c *Client) SDiffStore(destinationstring, keys ...string) *IntCmd

func (*Client)SInter

func (c *Client) SInter(keys ...string) *StringSliceCmd

func (*Client)SInterStore

func (c *Client) SInterStore(destinationstring, keys ...string) *IntCmd

func (*Client)SIsMember

func (c *Client) SIsMember(keystring, member interface{}) *BoolCmd

func (*Client)SMembers

func (c *Client) SMembers(keystring) *StringSliceCmd

Redis `SMEMBERS key` command output as a slice

func (*Client)SMembersMap

func (c *Client) SMembersMap(keystring) *StringStructMapCmd

Redis `SMEMBERS key` command output as a map

func (*Client)SMove

func (c *Client) SMove(source, destinationstring, member interface{}) *BoolCmd

func (*Client)SPop

func (c *Client) SPop(keystring) *StringCmd

Redis `SPOP key` command.

func (*Client)SPopN

func (c *Client) SPopN(keystring, countint64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Client)SRandMember

func (c *Client) SRandMember(keystring) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Client)SRandMemberN

func (c *Client) SRandMemberN(keystring, countint64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Client)SRem

func (c *Client) SRem(keystring, members ...interface{}) *IntCmd

func (*Client)SScan

func (c *Client) SScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*Client)SUnion

func (c *Client) SUnion(keys ...string) *StringSliceCmd

func (*Client)SUnionStore

func (c *Client) SUnionStore(destinationstring, keys ...string) *IntCmd

func (*Client)Save

func (c *Client) Save() *StatusCmd

func (*Client)Scan

func (c *Client) Scan(cursoruint64, matchstring, countint64) *ScanCmd
Example
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {redisdb.FlushDB()for i := 0; i < 33; i++ {err := redisdb.Set(fmt.Sprintf("key%d", i), "value", 0).Err()if err != nil {panic(err)}}var cursor uint64var n intfor {var keys []stringvar err errorkeys, cursor, err = redisdb.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 (c *Client) ScriptLoad(scriptstring) *StringCmd

func (*Client)Set

func (c *Client) Set(keystring, value interface{}, expirationtime.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Use expiration for `SETEX`-like behavior.Zero expiration means the key has no expiration time.

Example
package mainimport ("time""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {// Last argument is expiration. Zero means the key has no// expiration time.err := redisdb.Set("key", "value", 0).Err()if err != nil {panic(err)}// key2 will expire in an hour.err = redisdb.Set("key2", "value", time.Hour).Err()if err != nil {panic(err)}}

func (*Client)SetBit

func (c *Client) SetBit(keystring, offsetint64, valueint) *IntCmd

func (*Client)SetLimiter

func (c *Client) SetLimiter(lLimiter) *Client

func (*Client)SetNX

func (c *Client) SetNX(keystring, value interface{}, expirationtime.Duration) *BoolCmd

Redis `SET key value [expiration] NX` command.

Zero expiration means the key has no expiration time.

func (*Client)SetRange

func (c *Client) SetRange(keystring, offsetint64, valuestring) *IntCmd

func (*Client)SetXX

func (c *Client) SetXX(keystring, value interface{}, expirationtime.Duration) *BoolCmd

Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time.

func (*Client)Shutdown

func (c *Client) Shutdown() *StatusCmd

func (*Client)ShutdownNoSave

func (c *Client) ShutdownNoSave() *StatusCmd

func (*Client)ShutdownSave

func (c *Client) ShutdownSave() *StatusCmd

func (*Client)SlaveOf

func (c *Client) SlaveOf(host, portstring) *StatusCmd

func (*Client)SlowLog

func (c *Client) SlowLog()

func (*Client)Sort

func (c *Client) Sort(keystring, sort *Sort) *StringSliceCmd

func (*Client)SortInterfaces

func (c *Client) SortInterfaces(keystring, sort *Sort) *SliceCmd

func (*Client)SortStore

func (c *Client) SortStore(key, storestring, sort *Sort) *IntCmd

func (*Client)StrLen

func (c *Client) StrLen(keystring) *IntCmd

func (*Client)String

func (c *Client) String()string

func (*Client)Subscribe

func (c *Client) Subscribe(channels ...string) *PubSub

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 thesubscription 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 succeededcase *Message:    // received first messagecase *Pong:    // pong receiveddefault:    // handle error}ch := sub.Channel()

func (*Client)Sync

func (c *Client) Sync()

func (*Client)TTL

func (c *Client) TTL(keystring) *DurationCmd

func (*Client)Time

func (c *Client) Time() *TimeCmd

func (*Client)Touch

func (c *Client) Touch(keys ...string) *IntCmd

func (*Client)TxPipeline

func (c *Client) TxPipeline()Pipeliner

TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.

Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {pipe := redisdb.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 redisdb-server roundtrip._, err := pipe.Exec()fmt.Println(incr.Val(), err)}
Output:1 <nil>

func (*Client)TxPipelined

func (c *Client) TxPipelined(fn func(Pipeliner)error) ([]Cmder,error)
Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {var incr *redis.IntCmd_, err := redisdb.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)Type

func (c *Client) Type(keystring) *StatusCmd

func (*Client)Unlink

func (c *Client) Unlink(keys ...string) *IntCmd

func (*Client)Wait

func (c *Client) Wait(numSlavesint, timeouttime.Duration) *IntCmd

func (*Client)Watch

func (c *Client) Watch(fn func(*Tx)error, keys ...string)error

Watch prepares a transaction and marks the keys to be watchedfor conditional execution if there are any keys.

The transaction is automatically closed when fn exits.

Example
package mainimport ("errors""fmt""sync""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc init() {redisdb = redis.NewClient(&redis.Options{Addr:         ":6379",DialTimeout:  10 * time.Second,ReadTimeout:  30 * time.Second,WriteTimeout: 30 * time.Second,PoolSize:     10,PoolTimeout:  30 * time.Second,})}func main() {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 zeron, 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.Pipelined(func(pipe redis.Pipeliner) error {// pipe handles the error casepipe.Set(key, n, 0)return nil})return err}for retries := routineCount; retries > 0; retries-- {err := redisdb.Watch(txf, key)if err != redis.TxFailedErr {return err}// optimistic lock lost}return errors.New("increment reached maximum number of retries")}var wg sync.WaitGroupwg.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 := redisdb.Get("counter3").Int()fmt.Println("ended with", n, err)}
Output:ended with 100 <nil>

func (*Client)WithContext

func (c *Client) WithContext(ctxcontext.Context) *Client

func (*Client)WrapProcess

func (c *Client) WrapProcess(fn func(oldProcess func(cmdCmder)error) func(cmdCmder)error,)

WrapProcess wraps function that processes Redis commands.

func (*Client)WrapProcessPipeline

func (c *Client) WrapProcessPipeline(fn func(oldProcess func([]Cmder)error) func([]Cmder)error,)

func (*Client)XAck

func (c *Client) XAck(stream, groupstring, ids ...string) *IntCmd

func (*Client)XAdd

func (c *Client) XAdd(a *XAddArgs) *StringCmd

func (*Client)XClaim

func (c *Client) XClaim(a *XClaimArgs) *XMessageSliceCmd

func (*Client)XClaimJustID

func (c *Client) XClaimJustID(a *XClaimArgs) *StringSliceCmd

func (*Client)XDel

func (c *Client) XDel(streamstring, ids ...string) *IntCmd

func (*Client)XGroupCreate

func (c *Client) XGroupCreate(stream, group, startstring) *StatusCmd

func (*Client)XGroupCreateMkStream

func (c *Client) XGroupCreateMkStream(stream, group, startstring) *StatusCmd

func (*Client)XGroupDelConsumer

func (c *Client) XGroupDelConsumer(stream, group, consumerstring) *IntCmd

func (*Client)XGroupDestroy

func (c *Client) XGroupDestroy(stream, groupstring) *IntCmd

func (*Client)XGroupSetID

func (c *Client) XGroupSetID(stream, group, startstring) *StatusCmd

func (*Client)XLen

func (c *Client) XLen(streamstring) *IntCmd

func (*Client)XPending

func (c *Client) XPending(stream, groupstring) *XPendingCmd

func (*Client)XPendingExt

func (c *Client) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd

func (*Client)XRange

func (c *Client) XRange(stream, start, stopstring) *XMessageSliceCmd

func (*Client)XRangeN

func (c *Client) XRangeN(stream, start, stopstring, countint64) *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, stopstring) *XMessageSliceCmd

func (*Client)XRevRangeN

func (c *Client) XRevRangeN(stream, start, stopstring, countint64) *XMessageSliceCmd

func (*Client)XTrim

func (c *Client) XTrim(keystring, maxLenint64) *IntCmd

func (*Client)XTrimApprox

func (c *Client) XTrimApprox(keystring, maxLenint64) *IntCmd

func (*Client)ZAdd

func (c *Client) ZAdd(keystring, members ...Z) *IntCmd

Redis `ZADD key score member [score member ...]` command.

func (*Client)ZAddCh

func (c *Client) ZAddCh(keystring, members ...Z) *IntCmd

Redis `ZADD key CH score member [score member ...]` command.

func (*Client)ZAddNX

func (c *Client) ZAddNX(keystring, members ...Z) *IntCmd

Redis `ZADD key NX score member [score member ...]` command.

func (*Client)ZAddNXCh

func (c *Client) ZAddNXCh(keystring, members ...Z) *IntCmd

Redis `ZADD key NX CH score member [score member ...]` command.

func (*Client)ZAddXX

func (c *Client) ZAddXX(keystring, members ...Z) *IntCmd

Redis `ZADD key XX score member [score member ...]` command.

func (*Client)ZAddXXCh

func (c *Client) ZAddXXCh(keystring, members ...Z) *IntCmd

Redis `ZADD key XX CH score member [score member ...]` command.

func (*Client)ZCard

func (c *Client) ZCard(keystring) *IntCmd

func (*Client)ZCount

func (c *Client) ZCount(key, min, maxstring) *IntCmd

func (*Client)ZIncr

func (c *Client) ZIncr(keystring, memberZ) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Client)ZIncrBy

func (c *Client) ZIncrBy(keystring, incrementfloat64, memberstring) *FloatCmd

func (*Client)ZIncrNX

func (c *Client) ZIncrNX(keystring, memberZ) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Client)ZIncrXX

func (c *Client) ZIncrXX(keystring, memberZ) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Client)ZInterStore

func (c *Client) ZInterStore(destinationstring, storeZStore, keys ...string) *IntCmd

func (*Client)ZLexCount

func (c *Client) ZLexCount(key, min, maxstring) *IntCmd

func (*Client)ZPopMax

func (c *Client) ZPopMax(keystring, count ...int64) *ZSliceCmd

func (*Client)ZPopMin

func (c *Client) ZPopMin(keystring, count ...int64) *ZSliceCmd

func (*Client)ZRange

func (c *Client) ZRange(keystring, start, stopint64) *StringSliceCmd

func (*Client)ZRangeByLex

func (c *Client) ZRangeByLex(keystring, optZRangeBy) *StringSliceCmd

func (*Client)ZRangeByScore

func (c *Client) ZRangeByScore(keystring, optZRangeBy) *StringSliceCmd

func (*Client)ZRangeByScoreWithScores

func (c *Client) ZRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmd

func (*Client)ZRangeWithScores

func (c *Client) ZRangeWithScores(keystring, start, stopint64) *ZSliceCmd

func (*Client)ZRank

func (c *Client) ZRank(key, memberstring) *IntCmd

func (*Client)ZRem

func (c *Client) ZRem(keystring, members ...interface{}) *IntCmd

func (*Client)ZRemRangeByLex

func (c *Client) ZRemRangeByLex(key, min, maxstring) *IntCmd

func (*Client)ZRemRangeByRank

func (c *Client) ZRemRangeByRank(keystring, start, stopint64) *IntCmd

func (*Client)ZRemRangeByScore

func (c *Client) ZRemRangeByScore(key, min, maxstring) *IntCmd

func (*Client)ZRevRange

func (c *Client) ZRevRange(keystring, start, stopint64) *StringSliceCmd

func (*Client)ZRevRangeByLex

func (c *Client) ZRevRangeByLex(keystring, optZRangeBy) *StringSliceCmd

func (*Client)ZRevRangeByScore

func (c *Client) ZRevRangeByScore(keystring, optZRangeBy) *StringSliceCmd

func (*Client)ZRevRangeByScoreWithScores

func (c *Client) ZRevRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmd

func (*Client)ZRevRangeWithScores

func (c *Client) ZRevRangeWithScores(keystring, start, stopint64) *ZSliceCmd

func (*Client)ZRevRank

func (c *Client) ZRevRank(key, memberstring) *IntCmd

func (*Client)ZScan

func (c *Client) ZScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*Client)ZScore

func (c *Client) ZScore(key, memberstring) *FloatCmd

func (*Client)ZUnionStore

func (c *Client) ZUnionStore(deststring, storeZStore, keys ...string) *IntCmd

typeClusterClient

type ClusterClient struct {// contains filtered or unexported fields}

ClusterClient is a Redis Cluster client representing a pool of zeroor more underlying connections. It's safe for concurrent use bymultiple goroutines.

funcNewClusterClient

func NewClusterClient(opt *ClusterOptions) *ClusterClient

NewClusterClient returns a Redis Cluster client as described inhttp://redis.io/topics/cluster-spec.

Example
package mainimport ("github.com/go-redis/redis")func main() {// See http://redis.io/topics/cluster-tutorial for instructions// how to setup Redis Cluster.redisdb := redis.NewClusterClient(&redis.ClusterOptions{Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},})redisdb.Ping()}

Example (ManualSetup)

Following example creates a cluster from 2 master nodes and 2 slave nodeswithout using cluster mode or Redis Sentinel.

package mainimport ("github.com/go-redis/redis")func main() {// 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}redisdb := redis.NewClusterClient(&redis.ClusterOptions{ClusterSlots:  clusterSlots,RouteRandomly: true,})redisdb.Ping()// ReloadState reloads cluster state. It calls ClusterSlots func// to get cluster slots information.err := redisdb.ReloadState()if err != nil {panic(err)}}

func (*ClusterClient)Append

func (c *ClusterClient) Append(key, valuestring) *IntCmd

func (*ClusterClient)BLPop

func (c *ClusterClient) BLPop(timeouttime.Duration, keys ...string) *StringSliceCmd

func (*ClusterClient)BRPop

func (c *ClusterClient) BRPop(timeouttime.Duration, keys ...string) *StringSliceCmd

func (*ClusterClient)BRPopLPush

func (c *ClusterClient) BRPopLPush(source, destinationstring, timeouttime.Duration) *StringCmd

func (*ClusterClient)BZPopMax

func (c *ClusterClient) BZPopMax(timeouttime.Duration, keys ...string) *ZWithKeyCmd

Redis `BZPOPMAX key [key ...] timeout` command.

func (*ClusterClient)BZPopMin

func (c *ClusterClient) BZPopMin(timeouttime.Duration, keys ...string) *ZWithKeyCmd

Redis `BZPOPMIN key [key ...] timeout` command.

func (*ClusterClient)BgRewriteAOF

func (c *ClusterClient) BgRewriteAOF() *StatusCmd

func (*ClusterClient)BgSave

func (c *ClusterClient) BgSave() *StatusCmd

func (*ClusterClient)BitCount

func (c *ClusterClient) BitCount(keystring, bitCount *BitCount) *IntCmd

func (*ClusterClient)BitOpAnd

func (c *ClusterClient) BitOpAnd(destKeystring, keys ...string) *IntCmd

func (*ClusterClient)BitOpNot

func (c *ClusterClient) BitOpNot(destKeystring, keystring) *IntCmd

func (*ClusterClient)BitOpOr

func (c *ClusterClient) BitOpOr(destKeystring, keys ...string) *IntCmd

func (*ClusterClient)BitOpXor

func (c *ClusterClient) BitOpXor(destKeystring, keys ...string) *IntCmd

func (*ClusterClient)BitPos

func (c *ClusterClient) BitPos(keystring, bitint64, pos ...int64) *IntCmd

func (*ClusterClient)ClientGetName

func (c *ClusterClient) ClientGetName() *StringCmd

ClientGetName returns the name of the connection.

func (*ClusterClient)ClientID

func (c *ClusterClient) ClientID() *IntCmd

func (*ClusterClient)ClientKill

func (c *ClusterClient) ClientKill(ipPortstring) *StatusCmd

func (*ClusterClient)ClientKillByFilter

func (c *ClusterClient) ClientKillByFilter(keys ...string) *IntCmd

ClientKillByFilter is new style synx, while the ClientKill is oldCLIENT KILL <option> [value] ... <option> [value]

func (*ClusterClient)ClientList

func (c *ClusterClient) ClientList() *StringCmd

func (*ClusterClient)ClientPause

func (c *ClusterClient) ClientPause(durtime.Duration) *BoolCmd

func (*ClusterClient)ClientUnblock

func (c *ClusterClient) ClientUnblock(idint64) *IntCmd

func (*ClusterClient)ClientUnblockWithError

func (c *ClusterClient) ClientUnblockWithError(idint64) *IntCmd

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 meantto be long-lived and shared between many goroutines.

func (*ClusterClient)ClusterAddSlots

func (c *ClusterClient) ClusterAddSlots(slots ...int) *StatusCmd

func (*ClusterClient)ClusterAddSlotsRange

func (c *ClusterClient) ClusterAddSlotsRange(min, maxint) *StatusCmd

func (*ClusterClient)ClusterCountFailureReports

func (c *ClusterClient) ClusterCountFailureReports(nodeIDstring) *IntCmd

func (*ClusterClient)ClusterCountKeysInSlot

func (c *ClusterClient) ClusterCountKeysInSlot(slotint) *IntCmd

func (*ClusterClient)ClusterDelSlots

func (c *ClusterClient) ClusterDelSlots(slots ...int) *StatusCmd

func (*ClusterClient)ClusterDelSlotsRange

func (c *ClusterClient) ClusterDelSlotsRange(min, maxint) *StatusCmd

func (*ClusterClient)ClusterFailover

func (c *ClusterClient) ClusterFailover() *StatusCmd

func (*ClusterClient)ClusterForget

func (c *ClusterClient) ClusterForget(nodeIDstring) *StatusCmd

func (*ClusterClient)ClusterGetKeysInSlot

func (c *ClusterClient) ClusterGetKeysInSlot(slotint, countint) *StringSliceCmd

func (*ClusterClient)ClusterInfo

func (c *ClusterClient) ClusterInfo() *StringCmd

func (*ClusterClient)ClusterKeySlot

func (c *ClusterClient) ClusterKeySlot(keystring) *IntCmd

func (*ClusterClient)ClusterMeet

func (c *ClusterClient) ClusterMeet(host, portstring) *StatusCmd

func (*ClusterClient)ClusterNodes

func (c *ClusterClient) ClusterNodes() *StringCmd

func (*ClusterClient)ClusterReplicate

func (c *ClusterClient) ClusterReplicate(nodeIDstring) *StatusCmd

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(nodeIDstring) *StringSliceCmd

func (*ClusterClient)ClusterSlots

func (c *ClusterClient) ClusterSlots() *ClusterSlotsCmd

func (*ClusterClient)Command

func (c *ClusterClient) Command() *CommandsInfoCmd

func (*ClusterClient)ConfigGet

func (c *ClusterClient) ConfigGet(parameterstring) *SliceCmd

func (*ClusterClient)ConfigResetStat

func (c *ClusterClient) ConfigResetStat() *StatusCmd

func (*ClusterClient)ConfigRewrite

func (c *ClusterClient) ConfigRewrite() *StatusCmd

func (*ClusterClient)ConfigSet

func (c *ClusterClient) ConfigSet(parameter, valuestring) *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 (c *ClusterClient) DebugObject(keystring) *StringCmd

func (*ClusterClient)Decr

func (c *ClusterClient) Decr(keystring) *IntCmd

func (*ClusterClient)DecrBy

func (c *ClusterClient) DecrBy(keystring, decrementint64) *IntCmd

func (*ClusterClient)Del

func (c *ClusterClient) Del(keys ...string) *IntCmd

func (*ClusterClient)Do

func (c *ClusterClient) Do(args ...interface{}) *Cmd

Do creates a Cmd from the args and processes the cmd.

func (*ClusterClient)Dump

func (c *ClusterClient) Dump(keystring) *StringCmd

func (*ClusterClient)Echo

func (c *ClusterClient) Echo(message interface{}) *StringCmd

func (*ClusterClient)Eval

func (c *ClusterClient) Eval(scriptstring, keys []string, args ...interface{}) *Cmd

func (*ClusterClient)EvalSha

func (c *ClusterClient) EvalSha(sha1string, keys []string, args ...interface{}) *Cmd

func (*ClusterClient)Exists

func (c *ClusterClient) Exists(keys ...string) *IntCmd

func (*ClusterClient)Expire

func (c *ClusterClient) Expire(keystring, expirationtime.Duration) *BoolCmd

func (*ClusterClient)ExpireAt

func (c *ClusterClient) ExpireAt(keystring, tmtime.Time) *BoolCmd

func (*ClusterClient)FlushAll

func (c *ClusterClient) FlushAll() *StatusCmd

func (*ClusterClient)FlushAllAsync

func (c *ClusterClient) FlushAllAsync() *StatusCmd

func (*ClusterClient)FlushDB

func (c *ClusterClient) FlushDB() *StatusCmd

func (*ClusterClient)FlushDBAsync

func (c *ClusterClient) FlushDBAsync() *StatusCmd

func (*ClusterClient)FlushDb

func (c *ClusterClient) FlushDb() *StatusCmd

Deprecated. Use FlushDB instead.

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(keystring, geoLocation ...*GeoLocation) *IntCmd

func (*ClusterClient)GeoDist

func (c *ClusterClient) GeoDist(keystring, member1, member2, unitstring) *FloatCmd

func (*ClusterClient)GeoHash

func (c *ClusterClient) GeoHash(keystring, members ...string) *StringSliceCmd

func (*ClusterClient)GeoPos

func (c *ClusterClient) GeoPos(keystring, members ...string) *GeoPosCmd

func (*ClusterClient)GeoRadius

func (c *ClusterClient) GeoRadius(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterClient)GeoRadiusByMember

func (c *ClusterClient) GeoRadiusByMember(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterClient)GeoRadiusByMemberRO

func (c *ClusterClient) GeoRadiusByMemberRO(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterClient)GeoRadiusRO

func (c *ClusterClient) GeoRadiusRO(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterClient)Get

func (c *ClusterClient) Get(keystring) *StringCmd

Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (*ClusterClient)GetBit

func (c *ClusterClient) GetBit(keystring, offsetint64) *IntCmd

func (*ClusterClient)GetRange

func (c *ClusterClient) GetRange(keystring, start, endint64) *StringCmd

func (*ClusterClient)GetSet

func (c *ClusterClient) GetSet(keystring, value interface{}) *StringCmd

func (*ClusterClient)HDel

func (c *ClusterClient) HDel(keystring, fields ...string) *IntCmd

func (*ClusterClient)HExists

func (c *ClusterClient) HExists(key, fieldstring) *BoolCmd

func (*ClusterClient)HGet

func (c *ClusterClient) HGet(key, fieldstring) *StringCmd

func (*ClusterClient)HGetAll

func (c *ClusterClient) HGetAll(keystring) *StringStringMapCmd

func (*ClusterClient)HIncrBy

func (c *ClusterClient) HIncrBy(key, fieldstring, incrint64) *IntCmd

func (*ClusterClient)HIncrByFloat

func (c *ClusterClient) HIncrByFloat(key, fieldstring, incrfloat64) *FloatCmd

func (*ClusterClient)HKeys

func (c *ClusterClient) HKeys(keystring) *StringSliceCmd

func (*ClusterClient)HLen

func (c *ClusterClient) HLen(keystring) *IntCmd

func (*ClusterClient)HMGet

func (c *ClusterClient) HMGet(keystring, fields ...string) *SliceCmd

func (*ClusterClient)HMSet

func (c *ClusterClient) HMSet(keystring, fields map[string]interface{}) *StatusCmd

func (*ClusterClient)HScan

func (c *ClusterClient) HScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*ClusterClient)HSet

func (c *ClusterClient) HSet(key, fieldstring, value interface{}) *BoolCmd

func (*ClusterClient)HSetNX

func (c *ClusterClient) HSetNX(key, fieldstring, value interface{}) *BoolCmd

func (*ClusterClient)HVals

func (c *ClusterClient) HVals(keystring) *StringSliceCmd

func (*ClusterClient)Incr

func (c *ClusterClient) Incr(keystring) *IntCmd

func (*ClusterClient)IncrBy

func (c *ClusterClient) IncrBy(keystring, valueint64) *IntCmd

func (*ClusterClient)IncrByFloat

func (c *ClusterClient) IncrByFloat(keystring, valuefloat64) *FloatCmd

func (*ClusterClient)Info

func (c *ClusterClient) Info(section ...string) *StringCmd

func (*ClusterClient)Keys

func (c *ClusterClient) Keys(patternstring) *StringSliceCmd

func (*ClusterClient)LIndex

func (c *ClusterClient) LIndex(keystring, indexint64) *StringCmd

func (*ClusterClient)LInsert

func (c *ClusterClient) LInsert(key, opstring, pivot, value interface{}) *IntCmd

func (*ClusterClient)LInsertAfter

func (c *ClusterClient) LInsertAfter(keystring, pivot, value interface{}) *IntCmd

func (*ClusterClient)LInsertBefore

func (c *ClusterClient) LInsertBefore(keystring, pivot, value interface{}) *IntCmd

func (*ClusterClient)LLen

func (c *ClusterClient) LLen(keystring) *IntCmd

func (*ClusterClient)LPop

func (c *ClusterClient) LPop(keystring) *StringCmd

func (*ClusterClient)LPush

func (c *ClusterClient) LPush(keystring, values ...interface{}) *IntCmd

func (*ClusterClient)LPushX

func (c *ClusterClient) LPushX(keystring, value interface{}) *IntCmd

func (*ClusterClient)LRange

func (c *ClusterClient) LRange(keystring, start, stopint64) *StringSliceCmd

func (*ClusterClient)LRem

func (c *ClusterClient) LRem(keystring, countint64, value interface{}) *IntCmd

func (*ClusterClient)LSet

func (c *ClusterClient) LSet(keystring, indexint64, value interface{}) *StatusCmd

func (*ClusterClient)LTrim

func (c *ClusterClient) LTrim(keystring, start, stopint64) *StatusCmd

func (*ClusterClient)LastSave

func (c *ClusterClient) LastSave() *IntCmd

func (*ClusterClient)MGet

func (c *ClusterClient) MGet(keys ...string) *SliceCmd

func (*ClusterClient)MSet

func (c *ClusterClient) MSet(pairs ...interface{}) *StatusCmd

func (*ClusterClient)MSetNX

func (c *ClusterClient) MSetNX(pairs ...interface{}) *BoolCmd

func (*ClusterClient)MemoryUsage

func (c *ClusterClient) MemoryUsage(keystring, samples ...int) *IntCmd

func (*ClusterClient)Migrate

func (c *ClusterClient) Migrate(host, port, keystring, dbint64, timeouttime.Duration) *StatusCmd

func (*ClusterClient)Move

func (c *ClusterClient) Move(keystring, dbint64) *BoolCmd

func (*ClusterClient)ObjectEncoding

func (c *ClusterClient) ObjectEncoding(keystring) *StringCmd

func (*ClusterClient)ObjectIdleTime

func (c *ClusterClient) ObjectIdleTime(keystring) *DurationCmd

func (*ClusterClient)ObjectRefCount

func (c *ClusterClient) ObjectRefCount(keystring) *IntCmd

func (*ClusterClient)Options

func (c *ClusterClient) Options() *ClusterOptions

Options returns read-only Options that were used to create the client.

func (*ClusterClient)PExpire

func (c *ClusterClient) PExpire(keystring, expirationtime.Duration) *BoolCmd

func (*ClusterClient)PExpireAt

func (c *ClusterClient) PExpireAt(keystring, tmtime.Time) *BoolCmd

func (*ClusterClient)PFAdd

func (c *ClusterClient) PFAdd(keystring, els ...interface{}) *IntCmd

func (*ClusterClient)PFCount

func (c *ClusterClient) PFCount(keys ...string) *IntCmd

func (*ClusterClient)PFMerge

func (c *ClusterClient) PFMerge(deststring, keys ...string) *StatusCmd

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(keystring) *DurationCmd

func (*ClusterClient)Persist

func (c *ClusterClient) Persist(keystring) *BoolCmd

func (*ClusterClient)Ping

func (c *ClusterClient) Ping() *StatusCmd

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(cmdCmder)error

func (*ClusterClient)PubSubChannels

func (c *ClusterClient) PubSubChannels(patternstring) *StringSliceCmd

func (*ClusterClient)PubSubNumPat

func (c *ClusterClient) PubSubNumPat() *IntCmd

func (*ClusterClient)PubSubNumSub

func (c *ClusterClient) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*ClusterClient)Publish

func (c *ClusterClient) Publish(channelstring, message interface{}) *IntCmd

Publish posts the message to the channel.

func (*ClusterClient)Quit

func (c *ClusterClient) Quit() *StatusCmd

func (*ClusterClient)RPop

func (c *ClusterClient) RPop(keystring) *StringCmd

func (*ClusterClient)RPopLPush

func (c *ClusterClient) RPopLPush(source, destinationstring) *StringCmd

func (*ClusterClient)RPush

func (c *ClusterClient) RPush(keystring, values ...interface{}) *IntCmd

func (*ClusterClient)RPushX

func (c *ClusterClient) RPushX(keystring, value interface{}) *IntCmd

func (*ClusterClient)RandomKey

func (c *ClusterClient) RandomKey() *StringCmd

func (*ClusterClient)ReadOnly

func (c *ClusterClient) ReadOnly() *StatusCmd

func (*ClusterClient)ReadWrite

func (c *ClusterClient) ReadWrite() *StatusCmd

func (*ClusterClient)ReloadState

func (c *ClusterClient) ReloadState()error

ReloadState reloads cluster state. If available it calls ClusterSlots functo get cluster slots information.

func (*ClusterClient)Rename

func (c *ClusterClient) Rename(key, newkeystring) *StatusCmd

func (*ClusterClient)RenameNX

func (c *ClusterClient) RenameNX(key, newkeystring) *BoolCmd

func (*ClusterClient)Restore

func (c *ClusterClient) Restore(keystring, ttltime.Duration, valuestring) *StatusCmd

func (*ClusterClient)RestoreReplace

func (c *ClusterClient) RestoreReplace(keystring, ttltime.Duration, valuestring) *StatusCmd

func (*ClusterClient)SAdd

func (c *ClusterClient) SAdd(keystring, members ...interface{}) *IntCmd

func (*ClusterClient)SCard

func (c *ClusterClient) SCard(keystring) *IntCmd

func (*ClusterClient)SDiff

func (c *ClusterClient) SDiff(keys ...string) *StringSliceCmd

func (*ClusterClient)SDiffStore

func (c *ClusterClient) SDiffStore(destinationstring, keys ...string) *IntCmd

func (*ClusterClient)SInter

func (c *ClusterClient) SInter(keys ...string) *StringSliceCmd

func (*ClusterClient)SInterStore

func (c *ClusterClient) SInterStore(destinationstring, keys ...string) *IntCmd

func (*ClusterClient)SIsMember

func (c *ClusterClient) SIsMember(keystring, member interface{}) *BoolCmd

func (*ClusterClient)SMembers

func (c *ClusterClient) SMembers(keystring) *StringSliceCmd

Redis `SMEMBERS key` command output as a slice

func (*ClusterClient)SMembersMap

func (c *ClusterClient) SMembersMap(keystring) *StringStructMapCmd

Redis `SMEMBERS key` command output as a map

func (*ClusterClient)SMove

func (c *ClusterClient) SMove(source, destinationstring, member interface{}) *BoolCmd

func (*ClusterClient)SPop

func (c *ClusterClient) SPop(keystring) *StringCmd

Redis `SPOP key` command.

func (*ClusterClient)SPopN

func (c *ClusterClient) SPopN(keystring, countint64) *StringSliceCmd

Redis `SPOP key count` command.

func (*ClusterClient)SRandMember

func (c *ClusterClient) SRandMember(keystring) *StringCmd

Redis `SRANDMEMBER key` command.

func (*ClusterClient)SRandMemberN

func (c *ClusterClient) SRandMemberN(keystring, countint64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*ClusterClient)SRem

func (c *ClusterClient) SRem(keystring, members ...interface{}) *IntCmd

func (*ClusterClient)SScan

func (c *ClusterClient) SScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*ClusterClient)SUnion

func (c *ClusterClient) SUnion(keys ...string) *StringSliceCmd

func (*ClusterClient)SUnionStore

func (c *ClusterClient) SUnionStore(destinationstring, keys ...string) *IntCmd

func (*ClusterClient)Save

func (c *ClusterClient) Save() *StatusCmd

func (*ClusterClient)Scan

func (c *ClusterClient) Scan(cursoruint64, matchstring, countint64) *ScanCmd

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 (c *ClusterClient) ScriptLoad(scriptstring) *StringCmd

func (*ClusterClient)Set

func (c *ClusterClient) Set(keystring, value interface{}, expirationtime.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Use expiration for `SETEX`-like behavior.Zero expiration means the key has no expiration time.

func (*ClusterClient)SetBit

func (c *ClusterClient) SetBit(keystring, offsetint64, valueint) *IntCmd

func (*ClusterClient)SetNX

func (c *ClusterClient) SetNX(keystring, value interface{}, expirationtime.Duration) *BoolCmd

Redis `SET key value [expiration] NX` command.

Zero expiration means the key has no expiration time.

func (*ClusterClient)SetRange

func (c *ClusterClient) SetRange(keystring, offsetint64, valuestring) *IntCmd

func (*ClusterClient)SetXX

func (c *ClusterClient) SetXX(keystring, value interface{}, expirationtime.Duration) *BoolCmd

Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time.

func (*ClusterClient)Shutdown

func (c *ClusterClient) Shutdown() *StatusCmd

func (*ClusterClient)ShutdownNoSave

func (c *ClusterClient) ShutdownNoSave() *StatusCmd

func (*ClusterClient)ShutdownSave

func (c *ClusterClient) ShutdownSave() *StatusCmd

func (*ClusterClient)SlaveOf

func (c *ClusterClient) SlaveOf(host, portstring) *StatusCmd

func (*ClusterClient)SlowLog

func (c *ClusterClient) SlowLog()

func (*ClusterClient)Sort

func (c *ClusterClient) Sort(keystring, sort *Sort) *StringSliceCmd

func (*ClusterClient)SortInterfaces

func (c *ClusterClient) SortInterfaces(keystring, sort *Sort) *SliceCmd

func (*ClusterClient)SortStore

func (c *ClusterClient) SortStore(key, storestring, sort *Sort) *IntCmd

func (*ClusterClient)StrLen

func (c *ClusterClient) StrLen(keystring) *IntCmd

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)Sync

func (c *ClusterClient) Sync()

func (*ClusterClient)TTL

func (c *ClusterClient) TTL(keystring) *DurationCmd

func (*ClusterClient)Time

func (c *ClusterClient) Time() *TimeCmd

func (*ClusterClient)Touch

func (c *ClusterClient) Touch(keys ...string) *IntCmd

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)Type

func (c *ClusterClient) Type(keystring) *StatusCmd

func (*ClusterClient)Unlink

func (c *ClusterClient) Unlink(keys ...string) *IntCmd

func (*ClusterClient)Wait

func (c *ClusterClient) Wait(numSlavesint, timeouttime.Duration) *IntCmd

func (*ClusterClient)Watch

func (c *ClusterClient) Watch(fn func(*Tx)error, keys ...string)error

func (*ClusterClient)WithContext

func (c *ClusterClient) WithContext(ctxcontext.Context) *ClusterClient

func (*ClusterClient)WrapProcess

func (c *ClusterClient) WrapProcess(fn func(oldProcess func(Cmder)error) func(Cmder)error,)

func (*ClusterClient)WrapProcessPipeline

func (c *ClusterClient) WrapProcessPipeline(fn func(oldProcess func([]Cmder)error) func([]Cmder)error,)

func (*ClusterClient)XAck

func (c *ClusterClient) XAck(stream, groupstring, ids ...string) *IntCmd

func (*ClusterClient)XAdd

func (c *ClusterClient) XAdd(a *XAddArgs) *StringCmd

func (*ClusterClient)XClaim

func (c *ClusterClient) XClaim(a *XClaimArgs) *XMessageSliceCmd

func (*ClusterClient)XClaimJustID

func (c *ClusterClient) XClaimJustID(a *XClaimArgs) *StringSliceCmd

func (*ClusterClient)XDel

func (c *ClusterClient) XDel(streamstring, ids ...string) *IntCmd

func (*ClusterClient)XGroupCreate

func (c *ClusterClient) XGroupCreate(stream, group, startstring) *StatusCmd

func (*ClusterClient)XGroupCreateMkStream

func (c *ClusterClient) XGroupCreateMkStream(stream, group, startstring) *StatusCmd

func (*ClusterClient)XGroupDelConsumer

func (c *ClusterClient) XGroupDelConsumer(stream, group, consumerstring) *IntCmd

func (*ClusterClient)XGroupDestroy

func (c *ClusterClient) XGroupDestroy(stream, groupstring) *IntCmd

func (*ClusterClient)XGroupSetID

func (c *ClusterClient) XGroupSetID(stream, group, startstring) *StatusCmd

func (*ClusterClient)XLen

func (c *ClusterClient) XLen(streamstring) *IntCmd

func (*ClusterClient)XPending

func (c *ClusterClient) XPending(stream, groupstring) *XPendingCmd

func (*ClusterClient)XPendingExt

func (c *ClusterClient) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd

func (*ClusterClient)XRange

func (c *ClusterClient) XRange(stream, start, stopstring) *XMessageSliceCmd

func (*ClusterClient)XRangeN

func (c *ClusterClient) XRangeN(stream, start, stopstring, countint64) *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, stopstring) *XMessageSliceCmd

func (*ClusterClient)XRevRangeN

func (c *ClusterClient) XRevRangeN(stream, start, stopstring, countint64) *XMessageSliceCmd

func (*ClusterClient)XTrim

func (c *ClusterClient) XTrim(keystring, maxLenint64) *IntCmd

func (*ClusterClient)XTrimApprox

func (c *ClusterClient) XTrimApprox(keystring, maxLenint64) *IntCmd

func (*ClusterClient)ZAdd

func (c *ClusterClient) ZAdd(keystring, members ...Z) *IntCmd

Redis `ZADD key score member [score member ...]` command.

func (*ClusterClient)ZAddCh

func (c *ClusterClient) ZAddCh(keystring, members ...Z) *IntCmd

Redis `ZADD key CH score member [score member ...]` command.

func (*ClusterClient)ZAddNX

func (c *ClusterClient) ZAddNX(keystring, members ...Z) *IntCmd

Redis `ZADD key NX score member [score member ...]` command.

func (*ClusterClient)ZAddNXCh

func (c *ClusterClient) ZAddNXCh(keystring, members ...Z) *IntCmd

Redis `ZADD key NX CH score member [score member ...]` command.

func (*ClusterClient)ZAddXX

func (c *ClusterClient) ZAddXX(keystring, members ...Z) *IntCmd

Redis `ZADD key XX score member [score member ...]` command.

func (*ClusterClient)ZAddXXCh

func (c *ClusterClient) ZAddXXCh(keystring, members ...Z) *IntCmd

Redis `ZADD key XX CH score member [score member ...]` command.

func (*ClusterClient)ZCard

func (c *ClusterClient) ZCard(keystring) *IntCmd

func (*ClusterClient)ZCount

func (c *ClusterClient) ZCount(key, min, maxstring) *IntCmd

func (*ClusterClient)ZIncr

func (c *ClusterClient) ZIncr(keystring, memberZ) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*ClusterClient)ZIncrBy

func (c *ClusterClient) ZIncrBy(keystring, incrementfloat64, memberstring) *FloatCmd

func (*ClusterClient)ZIncrNX

func (c *ClusterClient) ZIncrNX(keystring, memberZ) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*ClusterClient)ZIncrXX

func (c *ClusterClient) ZIncrXX(keystring, memberZ) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*ClusterClient)ZInterStore

func (c *ClusterClient) ZInterStore(destinationstring, storeZStore, keys ...string) *IntCmd

func (*ClusterClient)ZLexCount

func (c *ClusterClient) ZLexCount(key, min, maxstring) *IntCmd

func (*ClusterClient)ZPopMax

func (c *ClusterClient) ZPopMax(keystring, count ...int64) *ZSliceCmd

func (*ClusterClient)ZPopMin

func (c *ClusterClient) ZPopMin(keystring, count ...int64) *ZSliceCmd

func (*ClusterClient)ZRange

func (c *ClusterClient) ZRange(keystring, start, stopint64) *StringSliceCmd

func (*ClusterClient)ZRangeByLex

func (c *ClusterClient) ZRangeByLex(keystring, optZRangeBy) *StringSliceCmd

func (*ClusterClient)ZRangeByScore

func (c *ClusterClient) ZRangeByScore(keystring, optZRangeBy) *StringSliceCmd

func (*ClusterClient)ZRangeByScoreWithScores

func (c *ClusterClient) ZRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmd

func (*ClusterClient)ZRangeWithScores

func (c *ClusterClient) ZRangeWithScores(keystring, start, stopint64) *ZSliceCmd

func (*ClusterClient)ZRank

func (c *ClusterClient) ZRank(key, memberstring) *IntCmd

func (*ClusterClient)ZRem

func (c *ClusterClient) ZRem(keystring, members ...interface{}) *IntCmd

func (*ClusterClient)ZRemRangeByLex

func (c *ClusterClient) ZRemRangeByLex(key, min, maxstring) *IntCmd

func (*ClusterClient)ZRemRangeByRank

func (c *ClusterClient) ZRemRangeByRank(keystring, start, stopint64) *IntCmd

func (*ClusterClient)ZRemRangeByScore

func (c *ClusterClient) ZRemRangeByScore(key, min, maxstring) *IntCmd

func (*ClusterClient)ZRevRange

func (c *ClusterClient) ZRevRange(keystring, start, stopint64) *StringSliceCmd

func (*ClusterClient)ZRevRangeByLex

func (c *ClusterClient) ZRevRangeByLex(keystring, optZRangeBy) *StringSliceCmd

func (*ClusterClient)ZRevRangeByScore

func (c *ClusterClient) ZRevRangeByScore(keystring, optZRangeBy) *StringSliceCmd

func (*ClusterClient)ZRevRangeByScoreWithScores

func (c *ClusterClient) ZRevRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmd

func (*ClusterClient)ZRevRangeWithScores

func (c *ClusterClient) ZRevRangeWithScores(keystring, start, stopint64) *ZSliceCmd

func (*ClusterClient)ZRevRank

func (c *ClusterClient) ZRevRank(key, memberstring) *IntCmd

func (*ClusterClient)ZScan

func (c *ClusterClient) ZScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*ClusterClient)ZScore

func (c *ClusterClient) ZScore(key, memberstring) *FloatCmd

func (*ClusterClient)ZUnionStore

func (c *ClusterClient) ZUnionStore(deststring, storeZStore, keys ...string) *IntCmd

typeClusterNode

type ClusterNode struct {IdstringAddrstring}

typeClusterOptions

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.MaxRedirectsint// Enables read-only commands on slave nodes.ReadOnlybool// Allows routing read-only commands to the closest master or slave node.// It automatically enables ReadOnly.RouteByLatencybool// Allows routing read-only commands to the random master or slave node.// It automatically enables ReadOnly.RouteRandomlybool// 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)OnConnect func(*Conn)errorPasswordstringMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.Duration// PoolSize applies per cluster node and not for the whole cluster.PoolSizeintMinIdleConnsintMaxConnAgetime.DurationPoolTimeouttime.DurationIdleTimeouttime.DurationIdleCheckFrequencytime.DurationTLSConfig *tls.Config}

ClusterOptions are used to configure a cluster client and should bepassed to NewClusterClient.

typeClusterSlot

type ClusterSlot struct {StartintEndintNodes []ClusterNode}

typeClusterSlotsCmd

type ClusterSlotsCmd struct {// contains filtered or unexported fields}

funcNewClusterSlotsCmd

func NewClusterSlotsCmd(args ...interface{}) *ClusterSlotsCmd

funcNewClusterSlotsCmdResult

func NewClusterSlotsCmdResult(val []ClusterSlot, errerror) *ClusterSlotsCmd

NewClusterSlotsCmdResult returns a ClusterSlotsCmd initialised with val and err for testing

func (*ClusterSlotsCmd)Args

func (cmd *ClusterSlotsCmd) Args() []interface{}

func (*ClusterSlotsCmd)Err

func (cmd *ClusterSlotsCmd) Err()error

func (*ClusterSlotsCmd)Name

func (cmd *ClusterSlotsCmd) Name()string

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

typeCmd

type Cmd struct {// contains filtered or unexported fields}

funcNewCmd

func NewCmd(args ...interface{}) *Cmd

funcNewCmdResult

func NewCmdResult(val interface{}, errerror) *Cmd

NewCmdResult returns a Cmd initialised with val and err for testing

func (*Cmd)Args

func (cmd *Cmd) Args() []interface{}

func (*Cmd)Bool

func (cmd *Cmd) Bool() (bool,error)

func (*Cmd)Err

func (cmd *Cmd) Err()error

func (*Cmd)Float32

func (cmd *Cmd) Float32() (float32,error)

func (*Cmd)Float64

func (cmd *Cmd) Float64() (float64,error)

func (*Cmd)Int

func (cmd *Cmd) Int() (int,error)

func (*Cmd)Int64

func (cmd *Cmd) Int64() (int64,error)

func (*Cmd)Name

func (cmd *Cmd) Name()string

func (*Cmd)Result

func (cmd *Cmd) Result() (interface{},error)

func (*Cmd)String

func (cmd *Cmd) String() (string,error)

func (*Cmd)Uint64

func (cmd *Cmd) Uint64() (uint64,error)

func (*Cmd)Val

func (cmd *Cmd) Val() interface{}

typeCmdable

type Cmdable interface {Pipeline()PipelinerPipelined(fn func(Pipeliner)error) ([]Cmder,error)TxPipelined(fn func(Pipeliner)error) ([]Cmder,error)TxPipeline()PipelinerCommand() *CommandsInfoCmdClientGetName() *StringCmdEcho(message interface{}) *StringCmdPing() *StatusCmdQuit() *StatusCmdDel(keys ...string) *IntCmdUnlink(keys ...string) *IntCmdDump(keystring) *StringCmdExists(keys ...string) *IntCmdExpire(keystring, expirationtime.Duration) *BoolCmdExpireAt(keystring, tmtime.Time) *BoolCmdKeys(patternstring) *StringSliceCmdMigrate(host, port, keystring, dbint64, timeouttime.Duration) *StatusCmdMove(keystring, dbint64) *BoolCmdObjectRefCount(keystring) *IntCmdObjectEncoding(keystring) *StringCmdObjectIdleTime(keystring) *DurationCmdPersist(keystring) *BoolCmdPExpire(keystring, expirationtime.Duration) *BoolCmdPExpireAt(keystring, tmtime.Time) *BoolCmdPTTL(keystring) *DurationCmdRandomKey() *StringCmdRename(key, newkeystring) *StatusCmdRenameNX(key, newkeystring) *BoolCmdRestore(keystring, ttltime.Duration, valuestring) *StatusCmdRestoreReplace(keystring, ttltime.Duration, valuestring) *StatusCmdSort(keystring, sort *Sort) *StringSliceCmdSortStore(key, storestring, sort *Sort) *IntCmdSortInterfaces(keystring, sort *Sort) *SliceCmdTouch(keys ...string) *IntCmdTTL(keystring) *DurationCmdType(keystring) *StatusCmdScan(cursoruint64, matchstring, countint64) *ScanCmdSScan(keystring, cursoruint64, matchstring, countint64) *ScanCmdHScan(keystring, cursoruint64, matchstring, countint64) *ScanCmdZScan(keystring, cursoruint64, matchstring, countint64) *ScanCmdAppend(key, valuestring) *IntCmdBitCount(keystring, bitCount *BitCount) *IntCmdBitOpAnd(destKeystring, keys ...string) *IntCmdBitOpOr(destKeystring, keys ...string) *IntCmdBitOpXor(destKeystring, keys ...string) *IntCmdBitOpNot(destKeystring, keystring) *IntCmdBitPos(keystring, bitint64, pos ...int64) *IntCmdDecr(keystring) *IntCmdDecrBy(keystring, decrementint64) *IntCmdGet(keystring) *StringCmdGetBit(keystring, offsetint64) *IntCmdGetRange(keystring, start, endint64) *StringCmdGetSet(keystring, value interface{}) *StringCmdIncr(keystring) *IntCmdIncrBy(keystring, valueint64) *IntCmdIncrByFloat(keystring, valuefloat64) *FloatCmdMGet(keys ...string) *SliceCmdMSet(pairs ...interface{}) *StatusCmdMSetNX(pairs ...interface{}) *BoolCmdSet(keystring, value interface{}, expirationtime.Duration) *StatusCmdSetBit(keystring, offsetint64, valueint) *IntCmdSetNX(keystring, value interface{}, expirationtime.Duration) *BoolCmdSetXX(keystring, value interface{}, expirationtime.Duration) *BoolCmdSetRange(keystring, offsetint64, valuestring) *IntCmdStrLen(keystring) *IntCmdHDel(keystring, fields ...string) *IntCmdHExists(key, fieldstring) *BoolCmdHGet(key, fieldstring) *StringCmdHGetAll(keystring) *StringStringMapCmdHIncrBy(key, fieldstring, incrint64) *IntCmdHIncrByFloat(key, fieldstring, incrfloat64) *FloatCmdHKeys(keystring) *StringSliceCmdHLen(keystring) *IntCmdHMGet(keystring, fields ...string) *SliceCmdHMSet(keystring, fields map[string]interface{}) *StatusCmdHSet(key, fieldstring, value interface{}) *BoolCmdHSetNX(key, fieldstring, value interface{}) *BoolCmdHVals(keystring) *StringSliceCmdBLPop(timeouttime.Duration, keys ...string) *StringSliceCmdBRPop(timeouttime.Duration, keys ...string) *StringSliceCmdBRPopLPush(source, destinationstring, timeouttime.Duration) *StringCmdLIndex(keystring, indexint64) *StringCmdLInsert(key, opstring, pivot, value interface{}) *IntCmdLInsertBefore(keystring, pivot, value interface{}) *IntCmdLInsertAfter(keystring, pivot, value interface{}) *IntCmdLLen(keystring) *IntCmdLPop(keystring) *StringCmdLPush(keystring, values ...interface{}) *IntCmdLPushX(keystring, value interface{}) *IntCmdLRange(keystring, start, stopint64) *StringSliceCmdLRem(keystring, countint64, value interface{}) *IntCmdLSet(keystring, indexint64, value interface{}) *StatusCmdLTrim(keystring, start, stopint64) *StatusCmdRPop(keystring) *StringCmdRPopLPush(source, destinationstring) *StringCmdRPush(keystring, values ...interface{}) *IntCmdRPushX(keystring, value interface{}) *IntCmdSAdd(keystring, members ...interface{}) *IntCmdSCard(keystring) *IntCmdSDiff(keys ...string) *StringSliceCmdSDiffStore(destinationstring, keys ...string) *IntCmdSInter(keys ...string) *StringSliceCmdSInterStore(destinationstring, keys ...string) *IntCmdSIsMember(keystring, member interface{}) *BoolCmdSMembers(keystring) *StringSliceCmdSMembersMap(keystring) *StringStructMapCmdSMove(source, destinationstring, member interface{}) *BoolCmdSPop(keystring) *StringCmdSPopN(keystring, countint64) *StringSliceCmdSRandMember(keystring) *StringCmdSRandMemberN(keystring, countint64) *StringSliceCmdSRem(keystring, members ...interface{}) *IntCmdSUnion(keys ...string) *StringSliceCmdSUnionStore(destinationstring, keys ...string) *IntCmdXAdd(a *XAddArgs) *StringCmdXDel(streamstring, ids ...string) *IntCmdXLen(streamstring) *IntCmdXRange(stream, start, stopstring) *XMessageSliceCmdXRangeN(stream, start, stopstring, countint64) *XMessageSliceCmdXRevRange(streamstring, start, stopstring) *XMessageSliceCmdXRevRangeN(streamstring, start, stopstring, countint64) *XMessageSliceCmdXRead(a *XReadArgs) *XStreamSliceCmdXReadStreams(streams ...string) *XStreamSliceCmdXGroupCreate(stream, group, startstring) *StatusCmdXGroupCreateMkStream(stream, group, startstring) *StatusCmdXGroupSetID(stream, group, startstring) *StatusCmdXGroupDestroy(stream, groupstring) *IntCmdXGroupDelConsumer(stream, group, consumerstring) *IntCmdXReadGroup(a *XReadGroupArgs) *XStreamSliceCmdXAck(stream, groupstring, ids ...string) *IntCmdXPending(stream, groupstring) *XPendingCmdXPendingExt(a *XPendingExtArgs) *XPendingExtCmdXClaim(a *XClaimArgs) *XMessageSliceCmdXClaimJustID(a *XClaimArgs) *StringSliceCmdXTrim(keystring, maxLenint64) *IntCmdXTrimApprox(keystring, maxLenint64) *IntCmdBZPopMax(timeouttime.Duration, keys ...string) *ZWithKeyCmdBZPopMin(timeouttime.Duration, keys ...string) *ZWithKeyCmdZAdd(keystring, members ...Z) *IntCmdZAddNX(keystring, members ...Z) *IntCmdZAddXX(keystring, members ...Z) *IntCmdZAddCh(keystring, members ...Z) *IntCmdZAddNXCh(keystring, members ...Z) *IntCmdZAddXXCh(keystring, members ...Z) *IntCmdZIncr(keystring, memberZ) *FloatCmdZIncrNX(keystring, memberZ) *FloatCmdZIncrXX(keystring, memberZ) *FloatCmdZCard(keystring) *IntCmdZCount(key, min, maxstring) *IntCmdZLexCount(key, min, maxstring) *IntCmdZIncrBy(keystring, incrementfloat64, memberstring) *FloatCmdZInterStore(destinationstring, storeZStore, keys ...string) *IntCmdZPopMax(keystring, count ...int64) *ZSliceCmdZPopMin(keystring, count ...int64) *ZSliceCmdZRange(keystring, start, stopint64) *StringSliceCmdZRangeWithScores(keystring, start, stopint64) *ZSliceCmdZRangeByScore(keystring, optZRangeBy) *StringSliceCmdZRangeByLex(keystring, optZRangeBy) *StringSliceCmdZRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmdZRank(key, memberstring) *IntCmdZRem(keystring, members ...interface{}) *IntCmdZRemRangeByRank(keystring, start, stopint64) *IntCmdZRemRangeByScore(key, min, maxstring) *IntCmdZRemRangeByLex(key, min, maxstring) *IntCmdZRevRange(keystring, start, stopint64) *StringSliceCmdZRevRangeWithScores(keystring, start, stopint64) *ZSliceCmdZRevRangeByScore(keystring, optZRangeBy) *StringSliceCmdZRevRangeByLex(keystring, optZRangeBy) *StringSliceCmdZRevRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmdZRevRank(key, memberstring) *IntCmdZScore(key, memberstring) *FloatCmdZUnionStore(deststring, storeZStore, keys ...string) *IntCmdPFAdd(keystring, els ...interface{}) *IntCmdPFCount(keys ...string) *IntCmdPFMerge(deststring, keys ...string) *StatusCmdBgRewriteAOF() *StatusCmdBgSave() *StatusCmdClientKill(ipPortstring) *StatusCmdClientKillByFilter(keys ...string) *IntCmdClientList() *StringCmdClientPause(durtime.Duration) *BoolCmdClientID() *IntCmdConfigGet(parameterstring) *SliceCmdConfigResetStat() *StatusCmdConfigSet(parameter, valuestring) *StatusCmdConfigRewrite() *StatusCmdDBSize() *IntCmdFlushAll() *StatusCmdFlushAllAsync() *StatusCmdFlushDB() *StatusCmdFlushDBAsync() *StatusCmdInfo(section ...string) *StringCmdLastSave() *IntCmdSave() *StatusCmdShutdown() *StatusCmdShutdownSave() *StatusCmdShutdownNoSave() *StatusCmdSlaveOf(host, portstring) *StatusCmdTime() *TimeCmdEval(scriptstring, keys []string, args ...interface{}) *CmdEvalSha(sha1string, keys []string, args ...interface{}) *CmdScriptExists(hashes ...string) *BoolSliceCmdScriptFlush() *StatusCmdScriptKill() *StatusCmdScriptLoad(scriptstring) *StringCmdDebugObject(keystring) *StringCmdPublish(channelstring, message interface{}) *IntCmdPubSubChannels(patternstring) *StringSliceCmdPubSubNumSub(channels ...string) *StringIntMapCmdPubSubNumPat() *IntCmdClusterSlots() *ClusterSlotsCmdClusterNodes() *StringCmdClusterMeet(host, portstring) *StatusCmdClusterForget(nodeIDstring) *StatusCmdClusterReplicate(nodeIDstring) *StatusCmdClusterResetSoft() *StatusCmdClusterResetHard() *StatusCmdClusterInfo() *StringCmdClusterKeySlot(keystring) *IntCmdClusterGetKeysInSlot(slotint, countint) *StringSliceCmdClusterCountFailureReports(nodeIDstring) *IntCmdClusterCountKeysInSlot(slotint) *IntCmdClusterDelSlots(slots ...int) *StatusCmdClusterDelSlotsRange(min, maxint) *StatusCmdClusterSaveConfig() *StatusCmdClusterSlaves(nodeIDstring) *StringSliceCmdClusterFailover() *StatusCmdClusterAddSlots(slots ...int) *StatusCmdClusterAddSlotsRange(min, maxint) *StatusCmdGeoAdd(keystring, geoLocation ...*GeoLocation) *IntCmdGeoPos(keystring, members ...string) *GeoPosCmdGeoRadius(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmdGeoRadiusRO(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmdGeoRadiusByMember(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmdGeoRadiusByMemberRO(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmdGeoDist(keystring, member1, member2, unitstring) *FloatCmdGeoHash(keystring, members ...string) *StringSliceCmdReadOnly() *StatusCmdReadWrite() *StatusCmdMemoryUsage(keystring, samples ...int) *IntCmd}

typeCmder

type Cmder interface {Name()stringArgs() []interface{}Err()error// contains filtered or unexported methods}

typeCommandInfo

type CommandInfo struct {NamestringArityint8Flags       []stringFirstKeyPosint8LastKeyPosint8StepCountint8ReadOnlybool}

typeCommandsInfoCmd

type CommandsInfoCmd struct {// contains filtered or unexported fields}

funcNewCommandsInfoCmd

func NewCommandsInfoCmd(args ...interface{}) *CommandsInfoCmd

funcNewCommandsInfoCmdResult

func NewCommandsInfoCmdResult(val map[string]*CommandInfo, errerror) *CommandsInfoCmd

NewCommandsInfoCmdResult returns a CommandsInfoCmd initialised with val and err for testing

func (*CommandsInfoCmd)Args

func (cmd *CommandsInfoCmd) Args() []interface{}

func (*CommandsInfoCmd)Err

func (cmd *CommandsInfoCmd) Err()error

func (*CommandsInfoCmd)Name

func (cmd *CommandsInfoCmd) Name()string

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

typeConn

type Conn struct {// contains filtered or unexported fields}

Conn is like Client, but its pool contains single connection.

func (*Conn)Auth

func (c *Conn) Auth(passwordstring) *StatusCmd

func (*Conn)ClientSetName

func (c *Conn) ClientSetName(namestring) *BoolCmd

ClientSetName assigns a name to the connection.

func (*Conn)Close

func (c *Conn) Close()error

Close closes the client, releasing any open resources.

It is rare to Close a Client, as the Client is meant to belong-lived and shared between many goroutines.

func (*Conn)Do

func (c *Conn) Do(args ...interface{}) *Cmd

Do creates a Cmd from the args and processes the cmd.

func (*Conn)Pipeline

func (c *Conn) Pipeline()Pipeliner

func (*Conn)Pipelined

func (c *Conn) Pipelined(fn func(Pipeliner)error) ([]Cmder,error)

func (*Conn)Process

func (c *Conn) Process(cmdCmder)error

func (*Conn)Select

func (c *Conn) Select(indexint) *StatusCmd

func (*Conn)String

func (c *Conn) String()string

func (*Conn)SwapDB

func (c *Conn) SwapDB(index1, index2int) *StatusCmd

func (*Conn)TxPipeline

func (c *Conn) TxPipeline()Pipeliner

TxPipeline acts like Pipeline, but wraps queued commands with MULTI/EXEC.

func (*Conn)TxPipelined

func (c *Conn) TxPipelined(fn func(Pipeliner)error) ([]Cmder,error)

func (*Conn)WrapProcess

func (c *Conn) WrapProcess(fn func(oldProcess func(cmdCmder)error) func(cmdCmder)error,)

WrapProcess wraps function that processes Redis commands.

func (*Conn)WrapProcessPipeline

func (c *Conn) WrapProcessPipeline(fn func(oldProcess func([]Cmder)error) func([]Cmder)error,)

typeDurationCmd

type DurationCmd struct {// contains filtered or unexported fields}

funcNewDurationCmd

func NewDurationCmd(precisiontime.Duration, args ...interface{}) *DurationCmd

funcNewDurationResult

func NewDurationResult(valtime.Duration, errerror) *DurationCmd

NewDurationResult returns a DurationCmd initialised with val and err for testing

func (*DurationCmd)Args

func (cmd *DurationCmd) Args() []interface{}

func (*DurationCmd)Err

func (cmd *DurationCmd) Err()error

func (*DurationCmd)Name

func (cmd *DurationCmd) Name()string

func (*DurationCmd)Result

func (cmd *DurationCmd) Result() (time.Duration,error)

func (*DurationCmd)String

func (cmd *DurationCmd) String()string

func (*DurationCmd)Val

func (cmd *DurationCmd) Val()time.Duration

typeFailoverOptions

type FailoverOptions struct {// The master name.MasterNamestring// A seed list of host:port addresses of sentinel nodes.SentinelAddrs []stringOnConnect func(*Conn)errorPasswordstringDBintMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.DurationPoolSizeintMinIdleConnsintMaxConnAgetime.DurationPoolTimeouttime.DurationIdleTimeouttime.DurationIdleCheckFrequencytime.DurationTLSConfig *tls.Config}

FailoverOptions are used to configure a failover client and shouldbe passed to NewFailoverClient.

typeFloatCmd

type FloatCmd struct {// contains filtered or unexported fields}

funcNewFloatCmd

func NewFloatCmd(args ...interface{}) *FloatCmd

funcNewFloatResult

func NewFloatResult(valfloat64, errerror) *FloatCmd

NewFloatResult returns a FloatCmd initialised with val and err for testing

func (*FloatCmd)Args

func (cmd *FloatCmd) Args() []interface{}

func (*FloatCmd)Err

func (cmd *FloatCmd) Err()error

func (*FloatCmd)Name

func (cmd *FloatCmd) Name()string

func (*FloatCmd)Result

func (cmd *FloatCmd) Result() (float64,error)

func (*FloatCmd)String

func (cmd *FloatCmd) String()string

func (*FloatCmd)Val

func (cmd *FloatCmd) Val()float64

typeGeoLocation

type GeoLocation struct {NamestringLongitude, Latitude, Distfloat64GeoHashint64}

GeoLocation is used with GeoAdd to add geospatial location.

typeGeoLocationCmd

type GeoLocationCmd struct {// contains filtered or unexported fields}

funcNewGeoLocationCmd

func NewGeoLocationCmd(q *GeoRadiusQuery, args ...interface{}) *GeoLocationCmd

funcNewGeoLocationCmdResult

func NewGeoLocationCmdResult(val []GeoLocation, errerror) *GeoLocationCmd

NewGeoLocationCmdResult returns a GeoLocationCmd initialised with val and err for testing

func (*GeoLocationCmd)Args

func (cmd *GeoLocationCmd) Args() []interface{}

func (*GeoLocationCmd)Err

func (cmd *GeoLocationCmd) Err()error

func (*GeoLocationCmd)Name

func (cmd *GeoLocationCmd) Name()string

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

typeGeoPos

type GeoPos struct {Longitude, Latitudefloat64}

typeGeoPosCmd

type GeoPosCmd struct {// contains filtered or unexported fields}

funcNewGeoPosCmd

func NewGeoPosCmd(args ...interface{}) *GeoPosCmd

func (*GeoPosCmd)Args

func (cmd *GeoPosCmd) Args() []interface{}

func (*GeoPosCmd)Err

func (cmd *GeoPosCmd) Err()error

func (*GeoPosCmd)Name

func (cmd *GeoPosCmd) Name()string

func (*GeoPosCmd)Result

func (cmd *GeoPosCmd) Result() ([]*GeoPos,error)

func (*GeoPosCmd)String

func (cmd *GeoPosCmd) String()string

func (*GeoPosCmd)Val

func (cmd *GeoPosCmd) Val() []*GeoPos

typeGeoRadiusQuery

type GeoRadiusQuery struct {Radiusfloat64// Can be m, km, ft, or mi. Default is km.UnitstringWithCoordboolWithDistboolWithGeoHashboolCountint// Can be ASC or DESC. Default is no sort order.SortstringStorestringStoreDiststring}

GeoRadiusQuery is used with GeoRadius to query geospatial index.

typeHash

Hash is type of hash function used in consistent hash.

typeIntCmd

type IntCmd struct {// contains filtered or unexported fields}

funcNewIntCmd

func NewIntCmd(args ...interface{}) *IntCmd

funcNewIntResult

func NewIntResult(valint64, errerror) *IntCmd

NewIntResult returns an IntCmd initialised with val and err for testing

func (*IntCmd)Args

func (cmd *IntCmd) Args() []interface{}

func (*IntCmd)Err

func (cmd *IntCmd) Err()error

func (*IntCmd)Name

func (cmd *IntCmd) Name()string

func (*IntCmd)Result

func (cmd *IntCmd) Result() (int64,error)

func (*IntCmd)String

func (cmd *IntCmd) String()string

func (*IntCmd)Val

func (cmd *IntCmd) Val()int64

typeLimiter

type Limiter interface {// Allow returns a nil if operation is allowed or an error otherwise.// If operation is allowed client must report the result of operation// whether 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(resulterror)}

Limiter is the interface of a rate limiter or a circuit breaker.

typeMessage

type Message struct {ChannelstringPatternstringPayloadstring}

Message received as result of a PUBLISH command issued by another client.

func (*Message)String

func (m *Message) String()string

typeOptions

type Options struct {// The network type, either tcp or unix.// Default is tcp.Networkstring// host:port address.Addrstring// Dialer creates new network connection and has priority over// Network and Addr options.Dialer func() (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.Passwordstring// Database to be selected after connecting to the server.DBint// Maximum number of retries before giving up.// Default is to not retry failed commands.MaxRetriesint// Minimum backoff between each retry.// Default is 8 milliseconds; -1 disables backoff.MinRetryBackofftime.Duration// Maximum backoff between each retry.// Default is 512 milliseconds; -1 disables backoff.MaxRetryBackofftime.Duration// Dial timeout for establishing new connections.// Default is 5 seconds.DialTimeouttime.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.ReadTimeouttime.Duration// Timeout for socket writes. If reached, commands will fail// with a timeout instead of blocking.// Default is ReadTimeout.WriteTimeouttime.Duration// Maximum number of socket connections.// Default is 10 connections per every CPU as reported by runtime.NumCPU.PoolSizeint// Minimum number of idle connections which is useful when establishing// new connection is slow.MinIdleConnsint// Connection age at which client retires (closes) the connection.// Default is to not close aged connections.MaxConnAgetime.Duration// Amount of time client waits for connection if all connections// are busy before returning an error.// Default is ReadTimeout + 1 second.PoolTimeouttime.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.IdleTimeouttime.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.IdleCheckFrequencytime.Duration// TLS Config to use. When set TLS will be negotiated.TLSConfig *tls.Config// contains filtered or unexported fields}

funcParseURL

func ParseURL(redisURLstring) (*Options,error)

ParseURL parses an URL into Options that can be used to connect to Redis.

Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc init() {redisdb = redis.NewClient(&redis.Options{Addr:         ":6379",DialTimeout:  10 * time.Second,ReadTimeout:  30 * time.Second,WriteTimeout: 30 * time.Second,PoolSize:     10,PoolTimeout:  30 * time.Second,})}func main() {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:6379db is 1password is qwerty

typePipeline

type Pipeline struct {// contains filtered or unexported fields}

Pipeline implements pipelining as described inhttp://redis.io/topics/pipelining. It's safe for concurrent useby multiple goroutines.

Example (Instrumentation)
package mainimport ("fmt""github.com/go-redis/redis")func main() {redisdb := redis.NewClient(&redis.Options{Addr: ":6379",})redisdb.WrapProcessPipeline(func(old func([]redis.Cmder) error) func([]redis.Cmder) error {return func(cmds []redis.Cmder) error {fmt.Printf("pipeline starting processing: %v\n", cmds)err := old(cmds)fmt.Printf("pipeline finished processing: %v\n", cmds)return err}})redisdb.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)Auth

func (c *Pipeline) Auth(passwordstring) *StatusCmd

func (*Pipeline)ClientSetName

func (c *Pipeline) ClientSetName(namestring) *BoolCmd

ClientSetName assigns a name to the connection.

func (*Pipeline)Close

func (c *Pipeline) Close()error

Close closes the pipeline, releasing any open resources.

func (*Pipeline)Discard

func (c *Pipeline) Discard()error

Discard resets the pipeline and discards queued commands.

func (*Pipeline)Do

func (c *Pipeline) Do(args ...interface{}) *Cmd

func (*Pipeline)Exec

func (c *Pipeline) Exec() ([]Cmder,error)

Exec executes all previously queued commands using oneclient-server roundtrip.

Exec always returns list of commands and error of the first failedcommand if any.

func (*Pipeline)Pipeline

func (c *Pipeline) Pipeline()Pipeliner

func (*Pipeline)Pipelined

func (c *Pipeline) Pipelined(fn func(Pipeliner)error) ([]Cmder,error)

func (*Pipeline)Process

func (c *Pipeline) Process(cmdCmder)error

Process queues the cmd for later execution.

func (*Pipeline)Select

func (c *Pipeline) Select(indexint) *StatusCmd

func (*Pipeline)SwapDB

func (c *Pipeline) SwapDB(index1, index2int) *StatusCmd

func (*Pipeline)TxPipeline

func (c *Pipeline) TxPipeline()Pipeliner

func (*Pipeline)TxPipelined

func (c *Pipeline) TxPipelined(fn func(Pipeliner)error) ([]Cmder,error)

typePipeliner

type Pipeliner interface {StatefulCmdableDo(args ...interface{}) *CmdProcess(cmdCmder)errorClose()errorDiscard()errorExec() ([]Cmder,error)}

Pipeliner is an mechanism to realise Redis Pipeline technique.

Pipelining is a technique to extremely speed up processing by packingoperations to batches, send them at once to Redis and read a replies in asinge step.Seehttps://redis.io/topics/pipelining

Pay attention, that Pipeline is not a transaction, so you can get unexpectedresults in case of big pipelines and small read/write timeouts.Redis client has retransmission logic in case of timeouts, pipelinecan be retransmitted and commands can be executed more then once.To avoid this: it is good idea to use reasonable bigger read/write timeoutsdepends of your batch size and/or use TxPipeline.

typePong

type Pong struct {Payloadstring}

Pong received as result of a PING command issued by another client.

func (*Pong)String

func (p *Pong) String()string

typePoolStats

type PoolStatspool.Stats

typePubSub

type PubSub struct {// contains filtered or unexported fields}

PubSub implements Pub/Sub commands as described inhttp://redis.io/topics/pubsub. Message receiving is NOT safefor concurrent use by multiple goroutines.

PubSub automatically reconnects to Redis Server and resubscribesto the channels in case of network errors.

Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc init() {redisdb = redis.NewClient(&redis.Options{Addr:         ":6379",DialTimeout:  10 * time.Second,ReadTimeout:  30 * time.Second,WriteTimeout: 30 * time.Second,PoolSize:     10,PoolTimeout:  30 * time.Second,})}func main() {pubsub := redisdb.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 = redisdb.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

func (c *PubSub) Channel() <-chan *Message

Channel returns a Go channel for concurrently receiving messages.It periodically sends Ping messages to test connection health.The channel is closed with PubSub. Receive* APIs can not be usedafter channel is created.

If the Go channel is full for 30 seconds the message is dropped.

func (*PubSub)ChannelSize

func (c *PubSub) ChannelSize(sizeint) <-chan *Message

ChannelSize is like Channel, but creates a Go channelwith specified buffer size.

func (*PubSub)Close

func (c *PubSub) Close()error

func (*PubSub)PSubscribe

func (c *PubSub) PSubscribe(patterns ...string)error

PSubscribe the client to the given patterns. It returnsempty subscription if there are no patterns.

func (*PubSub)PUnsubscribe

func (c *PubSub) PUnsubscribe(patterns ...string)error

PUnsubscribe the client from the given patterns, or from all ofthem if none is given.

func (*PubSub)Ping

func (c *PubSub) Ping(payload ...string)error

func (*PubSub)Receive

func (c *PubSub) Receive() (interface{},error)

Receive returns a message as a Subscription, Message, Pong or error.See PubSub example for details. This is low-level API and in most casesChannel should be used instead.

Example
package mainimport ("fmt""time""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {pubsub := redisdb.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 := redisdb.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 redisdb// received hello from mychannel2}

func (*PubSub)ReceiveMessage

func (c *PubSub) ReceiveMessage() (*Message,error)

ReceiveMessage returns a Message or error ignoring Subscription and Pongmessages. This is low-level API and in most cases Channel should be usedinstead.

func (*PubSub)ReceiveTimeout

func (c *PubSub) ReceiveTimeout(timeouttime.Duration) (interface{},error)

ReceiveTimeout acts like Receive but returns an error if messageis not received in time. This is low-level API and in most casesChannel should be used instead.

func (*PubSub)String

func (c *PubSub) String()string

func (*PubSub)Subscribe

func (c *PubSub) Subscribe(channels ...string)error

Subscribe the client to the specified channels. It returnsempty subscription if there are no channels.

func (*PubSub)Unsubscribe

func (c *PubSub) Unsubscribe(channels ...string)error

Unsubscribe the client from the given channels, or from all ofthem if none is given.

typeRing

type Ring struct {// contains filtered or unexported fields}

Ring is a Redis client that uses consistent hashing to distributekeys across multiple Redis servers (shards). It's safe forconcurrent use by multiple goroutines.

Ring monitors the state of each shard and removes dead shards fromthe ring. When a shard comes online it is added back to the ring. Thisgives you maximum availability and partition tolerance, but noconsistency between different shards or even clients. Each clientuses shards that are available to the client and does not do anycoordination when shard state is changed.

Ring should be used when you need multiple Redis servers for cachingand can tolerate losing data when one of the servers dies.Otherwise you should use Redis Cluster.

funcNewRing

func NewRing(opt *RingOptions) *Ring
Example
package mainimport ("github.com/go-redis/redis")func main() {redisdb := redis.NewRing(&redis.RingOptions{Addrs: map[string]string{"shard1": ":7000","shard2": ":7001","shard3": ":7002",},})redisdb.Ping()}

func (*Ring)Append

func (c *Ring) Append(key, valuestring) *IntCmd

func (*Ring)BLPop

func (c *Ring) BLPop(timeouttime.Duration, keys ...string) *StringSliceCmd

func (*Ring)BRPop

func (c *Ring) BRPop(timeouttime.Duration, keys ...string) *StringSliceCmd

func (*Ring)BRPopLPush

func (c *Ring) BRPopLPush(source, destinationstring, timeouttime.Duration) *StringCmd

func (*Ring)BZPopMax

func (c *Ring) BZPopMax(timeouttime.Duration, keys ...string) *ZWithKeyCmd

Redis `BZPOPMAX key [key ...] timeout` command.

func (*Ring)BZPopMin

func (c *Ring) BZPopMin(timeouttime.Duration, keys ...string) *ZWithKeyCmd

Redis `BZPOPMIN key [key ...] timeout` command.

func (*Ring)BgRewriteAOF

func (c *Ring) BgRewriteAOF() *StatusCmd

func (*Ring)BgSave

func (c *Ring) BgSave() *StatusCmd

func (*Ring)BitCount

func (c *Ring) BitCount(keystring, bitCount *BitCount) *IntCmd

func (*Ring)BitOpAnd

func (c *Ring) BitOpAnd(destKeystring, keys ...string) *IntCmd

func (*Ring)BitOpNot

func (c *Ring) BitOpNot(destKeystring, keystring) *IntCmd

func (*Ring)BitOpOr

func (c *Ring) BitOpOr(destKeystring, keys ...string) *IntCmd

func (*Ring)BitOpXor

func (c *Ring) BitOpXor(destKeystring, keys ...string) *IntCmd

func (*Ring)BitPos

func (c *Ring) BitPos(keystring, bitint64, pos ...int64) *IntCmd

func (*Ring)ClientGetName

func (c *Ring) ClientGetName() *StringCmd

ClientGetName returns the name of the connection.

func (*Ring)ClientID

func (c *Ring) ClientID() *IntCmd

func (*Ring)ClientKill

func (c *Ring) ClientKill(ipPortstring) *StatusCmd

func (*Ring)ClientKillByFilter

func (c *Ring) ClientKillByFilter(keys ...string) *IntCmd

ClientKillByFilter is new style synx, while the ClientKill is oldCLIENT KILL <option> [value] ... <option> [value]

func (*Ring)ClientList

func (c *Ring) ClientList() *StringCmd

func (*Ring)ClientPause

func (c *Ring) ClientPause(durtime.Duration) *BoolCmd

func (*Ring)ClientUnblock

func (c *Ring) ClientUnblock(idint64) *IntCmd

func (*Ring)ClientUnblockWithError

func (c *Ring) ClientUnblockWithError(idint64) *IntCmd

func (*Ring)Close

func (c *Ring) Close()error

Close closes the ring client, releasing any open resources.

It is rare to Close a Ring, as the Ring is meant to be long-livedand shared between many goroutines.

func (*Ring)ClusterAddSlots

func (c *Ring) ClusterAddSlots(slots ...int) *StatusCmd

func (*Ring)ClusterAddSlotsRange

func (c *Ring) ClusterAddSlotsRange(min, maxint) *StatusCmd

func (*Ring)ClusterCountFailureReports

func (c *Ring) ClusterCountFailureReports(nodeIDstring) *IntCmd

func (*Ring)ClusterCountKeysInSlot

func (c *Ring) ClusterCountKeysInSlot(slotint) *IntCmd

func (*Ring)ClusterDelSlots

func (c *Ring) ClusterDelSlots(slots ...int) *StatusCmd

func (*Ring)ClusterDelSlotsRange

func (c *Ring) ClusterDelSlotsRange(min, maxint) *StatusCmd

func (*Ring)ClusterFailover

func (c *Ring) ClusterFailover() *StatusCmd

func (*Ring)ClusterForget

func (c *Ring) ClusterForget(nodeIDstring) *StatusCmd

func (*Ring)ClusterGetKeysInSlot

func (c *Ring) ClusterGetKeysInSlot(slotint, countint) *StringSliceCmd

func (*Ring)ClusterInfo

func (c *Ring) ClusterInfo() *StringCmd

func (*Ring)ClusterKeySlot

func (c *Ring) ClusterKeySlot(keystring) *IntCmd

func (*Ring)ClusterMeet

func (c *Ring) ClusterMeet(host, portstring) *StatusCmd

func (*Ring)ClusterNodes

func (c *Ring) ClusterNodes() *StringCmd

func (*Ring)ClusterReplicate

func (c *Ring) ClusterReplicate(nodeIDstring) *StatusCmd

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(nodeIDstring) *StringSliceCmd

func (*Ring)ClusterSlots

func (c *Ring) ClusterSlots() *ClusterSlotsCmd

func (*Ring)Command

func (c *Ring) Command() *CommandsInfoCmd

func (*Ring)ConfigGet

func (c *Ring) ConfigGet(parameterstring) *SliceCmd

func (*Ring)ConfigResetStat

func (c *Ring) ConfigResetStat() *StatusCmd

func (*Ring)ConfigRewrite

func (c *Ring) ConfigRewrite() *StatusCmd

func (*Ring)ConfigSet

func (c *Ring) ConfigSet(parameter, valuestring) *StatusCmd

func (*Ring)Context

func (c *Ring) Context()context.Context

func (*Ring)DBSize

func (c *Ring) DBSize() *IntCmd

func (*Ring)DbSize

func (c *Ring) DbSize() *IntCmd

Deperecated. Use DBSize instead.

func (*Ring)DebugObject

func (c *Ring) DebugObject(keystring) *StringCmd

func (*Ring)Decr

func (c *Ring) Decr(keystring) *IntCmd

func (*Ring)DecrBy

func (c *Ring) DecrBy(keystring, decrementint64) *IntCmd

func (*Ring)Del

func (c *Ring) Del(keys ...string) *IntCmd

func (*Ring)Do

func (c *Ring) Do(args ...interface{}) *Cmd

Do creates a Cmd from the args and processes the cmd.

func (*Ring)Dump

func (c *Ring) Dump(keystring) *StringCmd

func (*Ring)Echo

func (c *Ring) Echo(message interface{}) *StringCmd

func (*Ring)Eval

func (c *Ring) Eval(scriptstring, keys []string, args ...interface{}) *Cmd

func (*Ring)EvalSha

func (c *Ring) EvalSha(sha1string, keys []string, args ...interface{}) *Cmd

func (*Ring)Exists

func (c *Ring) Exists(keys ...string) *IntCmd

func (*Ring)Expire

func (c *Ring) Expire(keystring, expirationtime.Duration) *BoolCmd

func (*Ring)ExpireAt

func (c *Ring) ExpireAt(keystring, tmtime.Time) *BoolCmd

func (*Ring)FlushAll

func (c *Ring) FlushAll() *StatusCmd

func (*Ring)FlushAllAsync

func (c *Ring) FlushAllAsync() *StatusCmd

func (*Ring)FlushDB

func (c *Ring) FlushDB() *StatusCmd

func (*Ring)FlushDBAsync

func (c *Ring) FlushDBAsync() *StatusCmd

func (*Ring)FlushDb

func (c *Ring) FlushDb() *StatusCmd

Deprecated. Use FlushDB instead.

func (*Ring)ForEachShard

func (c *Ring) ForEachShard(fn func(client *Client)error)error

ForEachShard concurrently calls the fn on each live shard in the ring.It returns the first error if any.

func (*Ring)GeoAdd

func (c *Ring) GeoAdd(keystring, geoLocation ...*GeoLocation) *IntCmd

func (*Ring)GeoDist

func (c *Ring) GeoDist(keystring, member1, member2, unitstring) *FloatCmd

func (*Ring)GeoHash

func (c *Ring) GeoHash(keystring, members ...string) *StringSliceCmd

func (*Ring)GeoPos

func (c *Ring) GeoPos(keystring, members ...string) *GeoPosCmd

func (*Ring)GeoRadius

func (c *Ring) GeoRadius(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Ring)GeoRadiusByMember

func (c *Ring) GeoRadiusByMember(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmd

func (*Ring)GeoRadiusByMemberRO

func (c *Ring) GeoRadiusByMemberRO(key, memberstring, query *GeoRadiusQuery) *GeoLocationCmd

func (*Ring)GeoRadiusRO

func (c *Ring) GeoRadiusRO(keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Ring)Get

func (c *Ring) Get(keystring) *StringCmd

Redis `GET key` command. It returns redis.Nil error when key does not exist.

func (*Ring)GetBit

func (c *Ring) GetBit(keystring, offsetint64) *IntCmd

func (*Ring)GetRange

func (c *Ring) GetRange(keystring, start, endint64) *StringCmd

func (*Ring)GetSet

func (c *Ring) GetSet(keystring, value interface{}) *StringCmd

func (*Ring)HDel

func (c *Ring) HDel(keystring, fields ...string) *IntCmd

func (*Ring)HExists

func (c *Ring) HExists(key, fieldstring) *BoolCmd

func (*Ring)HGet

func (c *Ring) HGet(key, fieldstring) *StringCmd

func (*Ring)HGetAll

func (c *Ring) HGetAll(keystring) *StringStringMapCmd

func (*Ring)HIncrBy

func (c *Ring) HIncrBy(key, fieldstring, incrint64) *IntCmd

func (*Ring)HIncrByFloat

func (c *Ring) HIncrByFloat(key, fieldstring, incrfloat64) *FloatCmd

func (*Ring)HKeys

func (c *Ring) HKeys(keystring) *StringSliceCmd

func (*Ring)HLen

func (c *Ring) HLen(keystring) *IntCmd

func (*Ring)HMGet

func (c *Ring) HMGet(keystring, fields ...string) *SliceCmd

func (*Ring)HMSet

func (c *Ring) HMSet(keystring, fields map[string]interface{}) *StatusCmd

func (*Ring)HScan

func (c *Ring) HScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*Ring)HSet

func (c *Ring) HSet(key, fieldstring, value interface{}) *BoolCmd

func (*Ring)HSetNX

func (c *Ring) HSetNX(key, fieldstring, value interface{}) *BoolCmd

func (*Ring)HVals

func (c *Ring) HVals(keystring) *StringSliceCmd

func (*Ring)Incr

func (c *Ring) Incr(keystring) *IntCmd

func (*Ring)IncrBy

func (c *Ring) IncrBy(keystring, valueint64) *IntCmd

func (*Ring)IncrByFloat

func (c *Ring) IncrByFloat(keystring, valuefloat64) *FloatCmd

func (*Ring)Info

func (c *Ring) Info(section ...string) *StringCmd

func (*Ring)Keys

func (c *Ring) Keys(patternstring) *StringSliceCmd

func (*Ring)LIndex

func (c *Ring) LIndex(keystring, indexint64) *StringCmd

func (*Ring)LInsert

func (c *Ring) LInsert(key, opstring, pivot, value interface{}) *IntCmd

func (*Ring)LInsertAfter

func (c *Ring) LInsertAfter(keystring, pivot, value interface{}) *IntCmd

func (*Ring)LInsertBefore

func (c *Ring) LInsertBefore(keystring, pivot, value interface{}) *IntCmd

func (*Ring)LLen

func (c *Ring) LLen(keystring) *IntCmd

func (*Ring)LPop

func (c *Ring) LPop(keystring) *StringCmd

func (*Ring)LPush

func (c *Ring) LPush(keystring, values ...interface{}) *IntCmd

func (*Ring)LPushX

func (c *Ring) LPushX(keystring, value interface{}) *IntCmd

func (*Ring)LRange

func (c *Ring) LRange(keystring, start, stopint64) *StringSliceCmd

func (*Ring)LRem

func (c *Ring) LRem(keystring, countint64, value interface{}) *IntCmd

func (*Ring)LSet

func (c *Ring) LSet(keystring, indexint64, value interface{}) *StatusCmd

func (*Ring)LTrim

func (c *Ring) LTrim(keystring, start, stopint64) *StatusCmd

func (*Ring)LastSave

func (c *Ring) LastSave() *IntCmd

func (*Ring)Len

func (c *Ring) Len()int

Len returns the current number of shards in the ring.

func (*Ring)MGet

func (c *Ring) MGet(keys ...string) *SliceCmd

func (*Ring)MSet

func (c *Ring) MSet(pairs ...interface{}) *StatusCmd

func (*Ring)MSetNX

func (c *Ring) MSetNX(pairs ...interface{}) *BoolCmd

func (*Ring)MemoryUsage

func (c *Ring) MemoryUsage(keystring, samples ...int) *IntCmd

func (*Ring)Migrate

func (c *Ring) Migrate(host, port, keystring, dbint64, timeouttime.Duration) *StatusCmd

func (*Ring)Move

func (c *Ring) Move(keystring, dbint64) *BoolCmd

func (*Ring)ObjectEncoding

func (c *Ring) ObjectEncoding(keystring) *StringCmd

func (*Ring)ObjectIdleTime

func (c *Ring) ObjectIdleTime(keystring) *DurationCmd

func (*Ring)ObjectRefCount

func (c *Ring) ObjectRefCount(keystring) *IntCmd

func (*Ring)Options

func (c *Ring) Options() *RingOptions

Options returns read-only Options that were used to create the client.

func (*Ring)PExpire

func (c *Ring) PExpire(keystring, expirationtime.Duration) *BoolCmd

func (*Ring)PExpireAt

func (c *Ring) PExpireAt(keystring, tmtime.Time) *BoolCmd

func (*Ring)PFAdd

func (c *Ring) PFAdd(keystring, els ...interface{}) *IntCmd

func (*Ring)PFCount

func (c *Ring) PFCount(keys ...string) *IntCmd

func (*Ring)PFMerge

func (c *Ring) PFMerge(deststring, keys ...string) *StatusCmd

func (*Ring)PSubscribe

func (c *Ring) PSubscribe(channels ...string) *PubSub

PSubscribe subscribes the client to the given patterns.

func (*Ring)PTTL

func (c *Ring) PTTL(keystring) *DurationCmd

func (*Ring)Persist

func (c *Ring) Persist(keystring) *BoolCmd

func (*Ring)Ping

func (c *Ring) Ping() *StatusCmd

func (*Ring)Pipeline

func (c *Ring) Pipeline()Pipeliner

func (*Ring)Pipelined

func (c *Ring) Pipelined(fn func(Pipeliner)error) ([]Cmder,error)

func (*Ring)PoolStats

func (c *Ring) PoolStats() *PoolStats

PoolStats returns accumulated connection pool stats.

func (*Ring)Process

func (c *Ring) Process(cmdCmder)error

func (*Ring)PubSubChannels

func (c *Ring) PubSubChannels(patternstring) *StringSliceCmd

func (*Ring)PubSubNumPat

func (c *Ring) PubSubNumPat() *IntCmd

func (*Ring)PubSubNumSub

func (c *Ring) PubSubNumSub(channels ...string) *StringIntMapCmd

func (*Ring)Publish

func (c *Ring) Publish(channelstring, message interface{}) *IntCmd

Publish posts the message to the channel.

func (*Ring)Quit

func (c *Ring) Quit() *StatusCmd

func (*Ring)RPop

func (c *Ring) RPop(keystring) *StringCmd

func (*Ring)RPopLPush

func (c *Ring) RPopLPush(source, destinationstring) *StringCmd

func (*Ring)RPush

func (c *Ring) RPush(keystring, values ...interface{}) *IntCmd

func (*Ring)RPushX

func (c *Ring) RPushX(keystring, value interface{}) *IntCmd

func (*Ring)RandomKey

func (c *Ring) RandomKey() *StringCmd

func (*Ring)ReadOnly

func (c *Ring) ReadOnly() *StatusCmd

func (*Ring)ReadWrite

func (c *Ring) ReadWrite() *StatusCmd

func (*Ring)Rename

func (c *Ring) Rename(key, newkeystring) *StatusCmd

func (*Ring)RenameNX

func (c *Ring) RenameNX(key, newkeystring) *BoolCmd

func (*Ring)Restore

func (c *Ring) Restore(keystring, ttltime.Duration, valuestring) *StatusCmd

func (*Ring)RestoreReplace

func (c *Ring) RestoreReplace(keystring, ttltime.Duration, valuestring) *StatusCmd

func (*Ring)SAdd

func (c *Ring) SAdd(keystring, members ...interface{}) *IntCmd

func (*Ring)SCard

func (c *Ring) SCard(keystring) *IntCmd

func (*Ring)SDiff

func (c *Ring) SDiff(keys ...string) *StringSliceCmd

func (*Ring)SDiffStore

func (c *Ring) SDiffStore(destinationstring, keys ...string) *IntCmd

func (*Ring)SInter

func (c *Ring) SInter(keys ...string) *StringSliceCmd

func (*Ring)SInterStore

func (c *Ring) SInterStore(destinationstring, keys ...string) *IntCmd

func (*Ring)SIsMember

func (c *Ring) SIsMember(keystring, member interface{}) *BoolCmd

func (*Ring)SMembers

func (c *Ring) SMembers(keystring) *StringSliceCmd

Redis `SMEMBERS key` command output as a slice

func (*Ring)SMembersMap

func (c *Ring) SMembersMap(keystring) *StringStructMapCmd

Redis `SMEMBERS key` command output as a map

func (*Ring)SMove

func (c *Ring) SMove(source, destinationstring, member interface{}) *BoolCmd

func (*Ring)SPop

func (c *Ring) SPop(keystring) *StringCmd

Redis `SPOP key` command.

func (*Ring)SPopN

func (c *Ring) SPopN(keystring, countint64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Ring)SRandMember

func (c *Ring) SRandMember(keystring) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Ring)SRandMemberN

func (c *Ring) SRandMemberN(keystring, countint64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Ring)SRem

func (c *Ring) SRem(keystring, members ...interface{}) *IntCmd

func (*Ring)SScan

func (c *Ring) SScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*Ring)SUnion

func (c *Ring) SUnion(keys ...string) *StringSliceCmd

func (*Ring)SUnionStore

func (c *Ring) SUnionStore(destinationstring, keys ...string) *IntCmd

func (*Ring)Save

func (c *Ring) Save() *StatusCmd

func (*Ring)Scan

func (c *Ring) Scan(cursoruint64, matchstring, countint64) *ScanCmd

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 (c *Ring) ScriptLoad(scriptstring) *StringCmd

func (*Ring)Set

func (c *Ring) Set(keystring, value interface{}, expirationtime.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Use expiration for `SETEX`-like behavior.Zero expiration means the key has no expiration time.

func (*Ring)SetBit

func (c *Ring) SetBit(keystring, offsetint64, valueint) *IntCmd

func (*Ring)SetNX

func (c *Ring) SetNX(keystring, value interface{}, expirationtime.Duration) *BoolCmd

Redis `SET key value [expiration] NX` command.

Zero expiration means the key has no expiration time.

func (*Ring)SetRange

func (c *Ring) SetRange(keystring, offsetint64, valuestring) *IntCmd

func (*Ring)SetXX

func (c *Ring) SetXX(keystring, value interface{}, expirationtime.Duration) *BoolCmd

Redis `SET key value [expiration] XX` command.

Zero expiration means the key has no expiration time.

func (*Ring)Shutdown

func (c *Ring) Shutdown() *StatusCmd

func (*Ring)ShutdownNoSave

func (c *Ring) ShutdownNoSave() *StatusCmd

func (*Ring)ShutdownSave

func (c *Ring) ShutdownSave() *StatusCmd

func (*Ring)SlaveOf

func (c *Ring) SlaveOf(host, portstring) *StatusCmd

func (*Ring)SlowLog

func (c *Ring) SlowLog()

func (*Ring)Sort

func (c *Ring) Sort(keystring, sort *Sort) *StringSliceCmd

func (*Ring)SortInterfaces

func (c *Ring) SortInterfaces(keystring, sort *Sort) *SliceCmd

func (*Ring)SortStore

func (c *Ring) SortStore(key, storestring, sort *Sort) *IntCmd

func (*Ring)StrLen

func (c *Ring) StrLen(keystring) *IntCmd

func (*Ring)Subscribe

func (c *Ring) Subscribe(channels ...string) *PubSub

Subscribe subscribes the client to the specified channels.

func (*Ring)Sync

func (c *Ring) Sync()

func (*Ring)TTL

func (c *Ring) TTL(keystring) *DurationCmd

func (*Ring)Time

func (c *Ring) Time() *TimeCmd

func (*Ring)Touch

func (c *Ring) Touch(keys ...string) *IntCmd

func (*Ring)TxPipeline

func (c *Ring) TxPipeline()Pipeliner

func (*Ring)TxPipelined

func (c *Ring) TxPipelined(fn func(Pipeliner)error) ([]Cmder,error)

func (*Ring)Type

func (c *Ring) Type(keystring) *StatusCmd

func (*Ring)Unlink

func (c *Ring) Unlink(keys ...string) *IntCmd

func (*Ring)Wait

func (c *Ring) Wait(numSlavesint, timeouttime.Duration) *IntCmd

func (*Ring)Watch

func (c *Ring) Watch(fn func(*Tx)error, keys ...string)error

func (*Ring)WithContext

func (c *Ring) WithContext(ctxcontext.Context) *Ring

func (*Ring)WrapProcess

func (c *Ring) WrapProcess(fn func(oldProcess func(cmdCmder)error) func(cmdCmder)error,)

func (*Ring)WrapProcessPipeline

func (c *Ring) WrapProcessPipeline(fn func(oldProcess func([]Cmder)error) func([]Cmder)error,)

func (*Ring)XAck

func (c *Ring) XAck(stream, groupstring, ids ...string) *IntCmd

func (*Ring)XAdd

func (c *Ring) XAdd(a *XAddArgs) *StringCmd

func (*Ring)XClaim

func (c *Ring) XClaim(a *XClaimArgs) *XMessageSliceCmd

func (*Ring)XClaimJustID

func (c *Ring) XClaimJustID(a *XClaimArgs) *StringSliceCmd

func (*Ring)XDel

func (c *Ring) XDel(streamstring, ids ...string) *IntCmd

func (*Ring)XGroupCreate

func (c *Ring) XGroupCreate(stream, group, startstring) *StatusCmd

func (*Ring)XGroupCreateMkStream

func (c *Ring) XGroupCreateMkStream(stream, group, startstring) *StatusCmd

func (*Ring)XGroupDelConsumer

func (c *Ring) XGroupDelConsumer(stream, group, consumerstring) *IntCmd

func (*Ring)XGroupDestroy

func (c *Ring) XGroupDestroy(stream, groupstring) *IntCmd

func (*Ring)XGroupSetID

func (c *Ring) XGroupSetID(stream, group, startstring) *StatusCmd

func (*Ring)XLen

func (c *Ring) XLen(streamstring) *IntCmd

func (*Ring)XPending

func (c *Ring) XPending(stream, groupstring) *XPendingCmd

func (*Ring)XPendingExt

func (c *Ring) XPendingExt(a *XPendingExtArgs) *XPendingExtCmd

func (*Ring)XRange

func (c *Ring) XRange(stream, start, stopstring) *XMessageSliceCmd

func (*Ring)XRangeN

func (c *Ring) XRangeN(stream, start, stopstring, countint64) *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, stopstring) *XMessageSliceCmd

func (*Ring)XRevRangeN

func (c *Ring) XRevRangeN(stream, start, stopstring, countint64) *XMessageSliceCmd

func (*Ring)XTrim

func (c *Ring) XTrim(keystring, maxLenint64) *IntCmd

func (*Ring)XTrimApprox

func (c *Ring) XTrimApprox(keystring, maxLenint64) *IntCmd

func (*Ring)ZAdd

func (c *Ring) ZAdd(keystring, members ...Z) *IntCmd

Redis `ZADD key score member [score member ...]` command.

func (*Ring)ZAddCh

func (c *Ring) ZAddCh(keystring, members ...Z) *IntCmd

Redis `ZADD key CH score member [score member ...]` command.

func (*Ring)ZAddNX

func (c *Ring) ZAddNX(keystring, members ...Z) *IntCmd

Redis `ZADD key NX score member [score member ...]` command.

func (*Ring)ZAddNXCh

func (c *Ring) ZAddNXCh(keystring, members ...Z) *IntCmd

Redis `ZADD key NX CH score member [score member ...]` command.

func (*Ring)ZAddXX

func (c *Ring) ZAddXX(keystring, members ...Z) *IntCmd

Redis `ZADD key XX score member [score member ...]` command.

func (*Ring)ZAddXXCh

func (c *Ring) ZAddXXCh(keystring, members ...Z) *IntCmd

Redis `ZADD key XX CH score member [score member ...]` command.

func (*Ring)ZCard

func (c *Ring) ZCard(keystring) *IntCmd

func (*Ring)ZCount

func (c *Ring) ZCount(key, min, maxstring) *IntCmd

func (*Ring)ZIncr

func (c *Ring) ZIncr(keystring, memberZ) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Ring)ZIncrBy

func (c *Ring) ZIncrBy(keystring, incrementfloat64, memberstring) *FloatCmd

func (*Ring)ZIncrNX

func (c *Ring) ZIncrNX(keystring, memberZ) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Ring)ZIncrXX

func (c *Ring) ZIncrXX(keystring, memberZ) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Ring)ZInterStore

func (c *Ring) ZInterStore(destinationstring, storeZStore, keys ...string) *IntCmd

func (*Ring)ZLexCount

func (c *Ring) ZLexCount(key, min, maxstring) *IntCmd

func (*Ring)ZPopMax

func (c *Ring) ZPopMax(keystring, count ...int64) *ZSliceCmd

func (*Ring)ZPopMin

func (c *Ring) ZPopMin(keystring, count ...int64) *ZSliceCmd

func (*Ring)ZRange

func (c *Ring) ZRange(keystring, start, stopint64) *StringSliceCmd

func (*Ring)ZRangeByLex

func (c *Ring) ZRangeByLex(keystring, optZRangeBy) *StringSliceCmd

func (*Ring)ZRangeByScore

func (c *Ring) ZRangeByScore(keystring, optZRangeBy) *StringSliceCmd

func (*Ring)ZRangeByScoreWithScores

func (c *Ring) ZRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmd

func (*Ring)ZRangeWithScores

func (c *Ring) ZRangeWithScores(keystring, start, stopint64) *ZSliceCmd

func (*Ring)ZRank

func (c *Ring) ZRank(key, memberstring) *IntCmd

func (*Ring)ZRem

func (c *Ring) ZRem(keystring, members ...interface{}) *IntCmd

func (*Ring)ZRemRangeByLex

func (c *Ring) ZRemRangeByLex(key, min, maxstring) *IntCmd

func (*Ring)ZRemRangeByRank

func (c *Ring) ZRemRangeByRank(keystring, start, stopint64) *IntCmd

func (*Ring)ZRemRangeByScore

func (c *Ring) ZRemRangeByScore(key, min, maxstring) *IntCmd

func (*Ring)ZRevRange

func (c *Ring) ZRevRange(keystring, start, stopint64) *StringSliceCmd

func (*Ring)ZRevRangeByLex

func (c *Ring) ZRevRangeByLex(keystring, optZRangeBy) *StringSliceCmd

func (*Ring)ZRevRangeByScore

func (c *Ring) ZRevRangeByScore(keystring, optZRangeBy) *StringSliceCmd

func (*Ring)ZRevRangeByScoreWithScores

func (c *Ring) ZRevRangeByScoreWithScores(keystring, optZRangeBy) *ZSliceCmd

func (*Ring)ZRevRangeWithScores

func (c *Ring) ZRevRangeWithScores(keystring, start, stopint64) *ZSliceCmd

func (*Ring)ZRevRank

func (c *Ring) ZRevRank(key, memberstring) *IntCmd

func (*Ring)ZScan

func (c *Ring) ZScan(keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (*Ring)ZScore

func (c *Ring) ZScore(key, memberstring) *FloatCmd

func (*Ring)ZUnionStore

func (c *Ring) ZUnionStore(deststring, storeZStore, keys ...string) *IntCmd

typeRingOptions

type RingOptions struct {// Map of name => host:port addresses of ring shards.Addrs map[string]string// Frequency of PING commands sent to check shards availability.// Shard is considered down after 3 subsequent failed checks.HeartbeatFrequencytime.Duration// Hash function used in consistent hash.// Default is crc32.ChecksumIEEE.HashHash// 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)       |//  --------------------------------------------------------////  Seehttps://arxiv.org/abs/1406.2294 for referenceHashReplicasintOnConnect func(*Conn)errorDBintPasswordstringMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.DurationPoolSizeintMinIdleConnsintMaxConnAgetime.DurationPoolTimeouttime.DurationIdleTimeouttime.DurationIdleCheckFrequencytime.Duration}

RingOptions are used to configure a ring client and should bepassed to NewRing.

typeScanCmd

type ScanCmd struct {// contains filtered or unexported fields}

funcNewScanCmd

func NewScanCmd(process func(cmdCmder)error, args ...interface{}) *ScanCmd

funcNewScanCmdResult

func NewScanCmdResult(keys []string, cursoruint64, errerror) *ScanCmd

NewScanCmdResult returns a ScanCmd initialised with val and err for testing

func (*ScanCmd)Args

func (cmd *ScanCmd) Args() []interface{}

func (*ScanCmd)Err

func (cmd *ScanCmd) Err()error

func (*ScanCmd)Iterator

func (cmd *ScanCmd) Iterator() *ScanIterator

Iterator creates a new ScanIterator.

Example
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {iter := redisdb.Scan(0, "", 0).Iterator()for iter.Next() {fmt.Println(iter.Val())}if err := iter.Err(); err != nil {panic(err)}}

func (*ScanCmd)Name

func (cmd *ScanCmd) Name()string

func (*ScanCmd)Result

func (cmd *ScanCmd) Result() (keys []string, cursoruint64, errerror)

func (*ScanCmd)String

func (cmd *ScanCmd) String()string

func (*ScanCmd)Val

func (cmd *ScanCmd) Val() (keys []string, cursoruint64)

typeScanIterator

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
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {iter := redisdb.Scan(0, "", 0).Iterator()for iter.Next() {fmt.Println(iter.Val())}if err := iter.Err(); err != nil {panic(err)}}

func (*ScanIterator)Err

func (it *ScanIterator) Err()error

Err returns the last iterator error, if any.

func (*ScanIterator)Next

func (it *ScanIterator) Next()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.

typeScript

type Script struct {// contains filtered or unexported fields}
Example
package mainimport ("fmt""github.com/go-redis/redis")var redisdb *redis.Clientfunc main() {IncrByXX := redis.NewScript(`if redis.call("GET", KEYS[1]) ~= false thenreturn redis.call("INCRBY", KEYS[1], ARGV[1])endreturn false`)n, err := IncrByXX.Run(redisdb, []string{"xx_counter"}, 2).Result()fmt.Println(n, err)err = redisdb.Set("xx_counter", "40", 0).Err()if err != nil {panic(err)}n, err = IncrByXX.Run(redisdb, []string{"xx_counter"}, 2).Result()fmt.Println(n, err)}
Output:<nil> redis: nil42 <nil>

funcNewScript

func NewScript(srcstring) *Script

func (*Script)Eval

func (s *Script) Eval(c scripter, keys []string, args ...interface{}) *Cmd

func (*Script)EvalSha

func (s *Script) EvalSha(c scripter, keys []string, args ...interface{}) *Cmd

func (*Script)Exists

func (s *Script) Exists(c scripter) *BoolSliceCmd

func (*Script)Hash

func (s *Script) Hash()string

func (*Script)Load

func (s *Script) Load(c scripter) *StringCmd

func (*Script)Run

func (s *Script) Run(c scripter, keys []string, args ...interface{}) *Cmd

Run optimistically uses EVALSHA to run the script. If script does not existit is retried using EVAL.

typeSentinelClient

type SentinelClient struct {// contains filtered or unexported fields}

funcNewSentinelClient

func NewSentinelClient(opt *Options) *SentinelClient

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 belong-lived and shared between many goroutines.

func (*SentinelClient)Do

func (c *SentinelClient) Do(args ...interface{}) *Cmd

Do creates a Cmd from the args and processes the cmd.

func (*SentinelClient)Failover

func (c *SentinelClient) Failover(namestring) *StatusCmd

Failover forces a failover as if the master was not reachable, and withoutasking for agreement to other Sentinels.

func (*SentinelClient)FlushConfig

func (c *SentinelClient) FlushConfig() *StatusCmd

FlushConfig forces Sentinel to rewrite its configuration on disk, includingthe current Sentinel state.

func (*SentinelClient)GetMasterAddrByName

func (c *SentinelClient) GetMasterAddrByName(namestring) *StringSliceCmd

func (*SentinelClient)Master

Master shows the state and info of the specified master.

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)Process

func (c *SentinelClient) Process(cmdCmder)error

func (*SentinelClient)Reset

func (c *SentinelClient) Reset(patternstring) *IntCmd

Reset resets all the masters with matching name. The pattern argument is aglob-style pattern. The reset process clears any previous state in a master(including a failover in progress), and removes every slave and sentinelalready discovered and associated with the master.

func (*SentinelClient)Sentinels

func (c *SentinelClient) Sentinels(namestring) *SliceCmd

func (*SentinelClient)String

func (c *SentinelClient) String()string

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)WrapProcess

func (c *SentinelClient) WrapProcess(fn func(oldProcess func(cmdCmder)error) func(cmdCmder)error,)

WrapProcess wraps function that processes Redis commands.

func (*SentinelClient)WrapProcessPipeline

func (c *SentinelClient) WrapProcessPipeline(fn func(oldProcess func([]Cmder)error) func([]Cmder)error,)

typeSliceCmd

type SliceCmd struct {// contains filtered or unexported fields}

funcNewSliceCmd

func NewSliceCmd(args ...interface{}) *SliceCmd

funcNewSliceResult

func NewSliceResult(val []interface{}, errerror) *SliceCmd

NewSliceResult returns a SliceCmd initialised with val and err for testing

func (*SliceCmd)Args

func (cmd *SliceCmd) Args() []interface{}

func (*SliceCmd)Err

func (cmd *SliceCmd) Err()error

func (*SliceCmd)Name

func (cmd *SliceCmd) Name()string

func (*SliceCmd)Result

func (cmd *SliceCmd) Result() ([]interface{},error)

func (*SliceCmd)String

func (cmd *SliceCmd) String()string

func (*SliceCmd)Val

func (cmd *SliceCmd) Val() []interface{}

typeSort

type Sort struct {BystringOffset, Countint64Get           []stringOrderstringAlphabool}

typeStatefulCmdable

type StatefulCmdable interface {CmdableAuth(passwordstring) *StatusCmdSelect(indexint) *StatusCmdSwapDB(index1, index2int) *StatusCmdClientSetName(namestring) *BoolCmd}

typeStatusCmd

type StatusCmd struct {// contains filtered or unexported fields}

funcNewStatusCmd

func NewStatusCmd(args ...interface{}) *StatusCmd

funcNewStatusResult

func NewStatusResult(valstring, errerror) *StatusCmd

NewStatusResult returns a StatusCmd initialised with val and err for testing

func (*StatusCmd)Args

func (cmd *StatusCmd) Args() []interface{}

func (*StatusCmd)Err

func (cmd *StatusCmd) Err()error

func (*StatusCmd)Name

func (cmd *StatusCmd) Name()string

func (*StatusCmd)Result

func (cmd *StatusCmd) Result() (string,error)

func (*StatusCmd)String

func (cmd *StatusCmd) String()string

func (*StatusCmd)Val

func (cmd *StatusCmd) Val()string

typeStringCmd

type StringCmd struct {// contains filtered or unexported fields}

funcNewStringCmd

func NewStringCmd(args ...interface{}) *StringCmd

funcNewStringResult

func NewStringResult(valstring, errerror) *StringCmd

NewStringResult returns a StringCmd initialised with val and err for testing

func (*StringCmd)Args

func (cmd *StringCmd) Args() []interface{}

func (*StringCmd)Bytes

func (cmd *StringCmd) Bytes() ([]byte,error)

func (*StringCmd)Err

func (cmd *StringCmd) Err()error

func (*StringCmd)Float32

func (cmd *StringCmd) Float32() (float32,error)

func (*StringCmd)Float64

func (cmd *StringCmd) Float64() (float64,error)

func (*StringCmd)Int

func (cmd *StringCmd) Int() (int,error)

func (*StringCmd)Int64

func (cmd *StringCmd) Int64() (int64,error)

func (*StringCmd)Name

func (cmd *StringCmd) Name()string

func (*StringCmd)Result

func (cmd *StringCmd) Result() (string,error)

func (*StringCmd)Scan

func (cmd *StringCmd) Scan(val interface{})error

func (*StringCmd)String

func (cmd *StringCmd) String()string

func (*StringCmd)Uint64

func (cmd *StringCmd) Uint64() (uint64,error)

func (*StringCmd)Val

func (cmd *StringCmd) Val()string

typeStringIntMapCmd

type StringIntMapCmd struct {// contains filtered or unexported fields}

funcNewStringIntMapCmd

func NewStringIntMapCmd(args ...interface{}) *StringIntMapCmd

funcNewStringIntMapCmdResult

func NewStringIntMapCmdResult(val map[string]int64, errerror) *StringIntMapCmd

NewStringIntMapCmdResult returns a StringIntMapCmd initialised with val and err for testing

func (*StringIntMapCmd)Args

func (cmd *StringIntMapCmd) Args() []interface{}

func (*StringIntMapCmd)Err

func (cmd *StringIntMapCmd) Err()error

func (*StringIntMapCmd)Name

func (cmd *StringIntMapCmd) Name()string

func (*StringIntMapCmd)Result

func (cmd *StringIntMapCmd) Result() (map[string]int64,error)

func (*StringIntMapCmd)String

func (cmd *StringIntMapCmd) String()string

func (*StringIntMapCmd)Val

func (cmd *StringIntMapCmd) Val() map[string]int64

typeStringSliceCmd

type StringSliceCmd struct {// contains filtered or unexported fields}

funcNewStringSliceCmd

func NewStringSliceCmd(args ...interface{}) *StringSliceCmd

funcNewStringSliceResult

func NewStringSliceResult(val []string, errerror) *StringSliceCmd

NewStringSliceResult returns a StringSliceCmd initialised with val and err for testing

func (*StringSliceCmd)Args

func (cmd *StringSliceCmd) Args() []interface{}

func (*StringSliceCmd)Err

func (cmd *StringSliceCmd) Err()error

func (*StringSliceCmd)Name

func (cmd *StringSliceCmd) Name()string

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

typeStringStringMapCmd

type StringStringMapCmd struct {// contains filtered or unexported fields}

funcNewStringStringMapCmd

func NewStringStringMapCmd(args ...interface{}) *StringStringMapCmd

funcNewStringStringMapResult

func NewStringStringMapResult(val map[string]string, errerror) *StringStringMapCmd

NewStringStringMapResult returns a StringStringMapCmd initialised with val and err for testing

func (*StringStringMapCmd)Args

func (cmd *StringStringMapCmd) Args() []interface{}

func (*StringStringMapCmd)Err

func (cmd *StringStringMapCmd) Err()error

func (*StringStringMapCmd)Name

func (cmd *StringStringMapCmd) Name()string

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

typeStringStructMapCmd

type StringStructMapCmd struct {// contains filtered or unexported fields}

funcNewStringStructMapCmd

func NewStringStructMapCmd(args ...interface{}) *StringStructMapCmd

func (*StringStructMapCmd)Args

func (cmd *StringStructMapCmd) Args() []interface{}

func (*StringStructMapCmd)Err

func (cmd *StringStructMapCmd) Err()error

func (*StringStructMapCmd)Name

func (cmd *StringStructMapCmd) Name()string

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{}

typeSubscription

type Subscription struct {// Can be "subscribe", "unsubscribe", "psubscribe" or "punsubscribe".Kindstring// Channel name we have subscribed to.Channelstring// Number of channels we are currently subscribed to.Countint}

Subscription received after a successful subscription to channel.

func (*Subscription)String

func (m *Subscription) String()string

typeTimeCmd

type TimeCmd struct {// contains filtered or unexported fields}

funcNewTimeCmd

func NewTimeCmd(args ...interface{}) *TimeCmd

func (*TimeCmd)Args

func (cmd *TimeCmd) Args() []interface{}

func (*TimeCmd)Err

func (cmd *TimeCmd) Err()error

func (*TimeCmd)Name

func (cmd *TimeCmd) Name()string

func (*TimeCmd)Result

func (cmd *TimeCmd) Result() (time.Time,error)

func (*TimeCmd)String

func (cmd *TimeCmd) String()string

func (*TimeCmd)Val

func (cmd *TimeCmd) Val()time.Time

typeTx

type Tx struct {// contains filtered or unexported fields}

Tx implements Redis transactions as described inhttp://redis.io/topics/transactions. It's NOT safe for concurrent useby multiple goroutines, because Exec resets list of watched keys.If you don't need WATCH it is better to use Pipeline.

func (*Tx)Auth

func (c *Tx) Auth(passwordstring) *StatusCmd

func (*Tx)ClientSetName

func (c *Tx) ClientSetName(namestring) *BoolCmd

ClientSetName assigns a name to the connection.

func (*Tx)Close

func (c *Tx) Close()error

Close closes the transaction, releasing any open resources.

func (*Tx)Do

func (c *Tx) Do(args ...interface{}) *Cmd

Do creates a Cmd from the args and processes the cmd.

func (*Tx)Pipeline

func (c *Tx) Pipeline()Pipeliner

Pipeline creates a new pipeline. It is more convenient to use Pipelined.

func (*Tx)Pipelined

func (c *Tx) Pipelined(fn func(Pipeliner)error) ([]Cmder,error)

Pipelined executes commands queued in the fn in a transaction.

When using WATCH, EXEC will execute commands only if the watched keyswere not modified, allowing for a check-and-set mechanism.

Exec always returns list of commands. If transaction failsTxFailedErr is returned. Otherwise Exec returns an error of the firstfailed command or nil.

func (*Tx)Process

func (c *Tx) Process(cmdCmder)error

func (*Tx)Select

func (c *Tx) Select(indexint) *StatusCmd

func (*Tx)String

func (c *Tx) String()string

func (*Tx)SwapDB

func (c *Tx) SwapDB(index1, index2int) *StatusCmd

func (*Tx)TxPipeline

func (c *Tx) TxPipeline()Pipeliner

TxPipeline is an alias for Pipeline.

func (*Tx)TxPipelined

func (c *Tx) TxPipelined(fn func(Pipeliner)error) ([]Cmder,error)

TxPipelined is an alias for Pipelined.

func (*Tx)Unwatch

func (c *Tx) Unwatch(keys ...string) *StatusCmd

Unwatch flushes all the previously watched keys for a transaction.

func (*Tx)Watch

func (c *Tx) Watch(keys ...string) *StatusCmd

Watch marks the keys to be watched for conditional executionof a transaction.

func (*Tx)WrapProcess

func (c *Tx) WrapProcess(fn func(oldProcess func(cmdCmder)error) func(cmdCmder)error,)

WrapProcess wraps function that processes Redis commands.

func (*Tx)WrapProcessPipeline

func (c *Tx) WrapProcessPipeline(fn func(oldProcess func([]Cmder)error) func([]Cmder)error,)

typeUniversalClient

type UniversalClient interface {CmdableWatch(fn func(*Tx)error, keys ...string)errorProcess(cmdCmder)errorWrapProcess(fn func(oldProcess func(cmdCmder)error) func(cmdCmder)error)WrapProcessPipeline(fn func(oldProcess func([]Cmder)error) func([]Cmder)error)Subscribe(channels ...string) *PubSubPSubscribe(channels ...string) *PubSubClose()error}

UniversalClient is an abstract client which - based on the provided options -can connect to either clusters, or sentinel-backed failover instances or simplesingle-instance servers. This can be useful for testing cluster-specificapplications locally.

funcNewUniversalClient

func NewUniversalClient(opts *UniversalOptions)UniversalClient

NewUniversalClient returns a new multi client. The type of client returned dependson the following three conditions:

1. if a MasterName is passed a sentinel-backed FailoverClient will be returned2. if the number of Addrs is two or more, a ClusterClient will be returned3. otherwise, a single-node redis Client will be returned.

Example (Cluster)
package mainimport ("github.com/go-redis/redis")func main() {redisdb := redis.NewUniversalClient(&redis.UniversalOptions{Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},})defer redisdb.Close()redisdb.Ping()}

Example (Failover)
package mainimport ("github.com/go-redis/redis")func main() {redisdb := redis.NewUniversalClient(&redis.UniversalOptions{MasterName: "master",Addrs:      []string{":26379"},})defer redisdb.Close()redisdb.Ping()}

Example (Simple)
package mainimport ("github.com/go-redis/redis")func main() {redisdb := redis.NewUniversalClient(&redis.UniversalOptions{Addrs: []string{":6379"},})defer redisdb.Close()redisdb.Ping()}

typeUniversalOptions

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.DBintOnConnect          func(*Conn)errorPasswordstringMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.DurationPoolSizeintMinIdleConnsintMaxConnAgetime.DurationPoolTimeouttime.DurationIdleTimeouttime.DurationIdleCheckFrequencytime.DurationTLSConfig          *tls.ConfigMaxRedirectsintReadOnlyboolRouteByLatencyboolRouteRandomlybool// The sentinel master name.// Only failover clients.MasterNamestring}

UniversalOptions information is required by UniversalClient to establishconnections.

typeXAddArgs

type XAddArgs struct {StreamstringMaxLenint64// MAXLEN NMaxLenApproxint64// MAXLEN ~ NIDstringValues       map[string]interface{}}

typeXClaimArgs

type XClaimArgs struct {StreamstringGroupstringConsumerstringMinIdletime.DurationMessages []string}

typeXMessage

type XMessage struct {IDstringValues map[string]interface{}}

typeXMessageSliceCmd

type XMessageSliceCmd struct {// contains filtered or unexported fields}

funcNewXMessageSliceCmd

func NewXMessageSliceCmd(args ...interface{}) *XMessageSliceCmd

func (*XMessageSliceCmd)Args

func (cmd *XMessageSliceCmd) Args() []interface{}

func (*XMessageSliceCmd)Err

func (cmd *XMessageSliceCmd) Err()error

func (*XMessageSliceCmd)Name

func (cmd *XMessageSliceCmd) Name()string

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

typeXPending

type XPending struct {Countint64LowerstringHigherstringConsumers map[string]int64}

typeXPendingCmd

type XPendingCmd struct {// contains filtered or unexported fields}

funcNewXPendingCmd

func NewXPendingCmd(args ...interface{}) *XPendingCmd

func (*XPendingCmd)Args

func (cmd *XPendingCmd) Args() []interface{}

func (*XPendingCmd)Err

func (cmd *XPendingCmd) Err()error

func (*XPendingCmd)Name

func (cmd *XPendingCmd) Name()string

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

typeXPendingExt

type XPendingExt struct {IdstringConsumerstringIdletime.DurationRetryCountint64}

typeXPendingExtArgs

type XPendingExtArgs struct {StreamstringGroupstringStartstringEndstringCountint64Consumerstring}

typeXPendingExtCmd

type XPendingExtCmd struct {// contains filtered or unexported fields}

funcNewXPendingExtCmd

func NewXPendingExtCmd(args ...interface{}) *XPendingExtCmd

func (*XPendingExtCmd)Args

func (cmd *XPendingExtCmd) Args() []interface{}

func (*XPendingExtCmd)Err

func (cmd *XPendingExtCmd) Err()error

func (*XPendingExtCmd)Name

func (cmd *XPendingExtCmd) Name()string

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

typeXReadArgs

type XReadArgs struct {Streams []stringCountint64Blocktime.Duration}

typeXReadGroupArgs

type XReadGroupArgs struct {GroupstringConsumerstring// List of streams and ids.Streams []stringCountint64Blocktime.DurationNoAckbool}

typeXStream

type XStream struct {StreamstringMessages []XMessage}

typeXStreamSliceCmd

type XStreamSliceCmd struct {// contains filtered or unexported fields}

funcNewXStreamSliceCmd

func NewXStreamSliceCmd(args ...interface{}) *XStreamSliceCmd

func (*XStreamSliceCmd)Args

func (cmd *XStreamSliceCmd) Args() []interface{}

func (*XStreamSliceCmd)Err

func (cmd *XStreamSliceCmd) Err()error

func (*XStreamSliceCmd)Name

func (cmd *XStreamSliceCmd) Name()string

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

typeZ

type Z struct {Scorefloat64Member interface{}}

Z represents sorted set member.

typeZRangeBy

type ZRangeBy struct {Min, MaxstringOffset, Countint64}

typeZSliceCmd

type ZSliceCmd struct {// contains filtered or unexported fields}

funcNewZSliceCmd

func NewZSliceCmd(args ...interface{}) *ZSliceCmd

funcNewZSliceCmdResult

func NewZSliceCmdResult(val []Z, errerror) *ZSliceCmd

NewZSliceCmdResult returns a ZSliceCmd initialised with val and err for testing

func (*ZSliceCmd)Args

func (cmd *ZSliceCmd) Args() []interface{}

func (*ZSliceCmd)Err

func (cmd *ZSliceCmd) Err()error

func (*ZSliceCmd)Name

func (cmd *ZSliceCmd) Name()string

func (*ZSliceCmd)Result

func (cmd *ZSliceCmd) Result() ([]Z,error)

func (*ZSliceCmd)String

func (cmd *ZSliceCmd) String()string

func (*ZSliceCmd)Val

func (cmd *ZSliceCmd) Val() []Z

typeZStore

type ZStore struct {Weights []float64// Can be SUM, MIN or MAX.Aggregatestring}

ZStore is used as an arg to ZInterStore and ZUnionStore.

typeZWithKey

type ZWithKey struct {ZKeystring}

ZWithKey represents sorted set member including the name of the key where it was popped.

typeZWithKeyCmd

type ZWithKeyCmd struct {// contains filtered or unexported fields}

funcNewZWithKeyCmd

func NewZWithKeyCmd(args ...interface{}) *ZWithKeyCmd

func (*ZWithKeyCmd)Args

func (cmd *ZWithKeyCmd) Args() []interface{}

func (*ZWithKeyCmd)Err

func (cmd *ZWithKeyCmd) Err()error

func (*ZWithKeyCmd)Name

func (cmd *ZWithKeyCmd) Name()string

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

Source Files

View all Source files

Directories

PathSynopsis
example
hllmodule
otelmodule
extra
rediscmdmodule
redisotelmodule
consistenthash
Package consistenthash provides an implementation of a ring hash.
Package consistenthash provides an implementation of a ring hash.
customvetmodule

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp