Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv9.

redis

packagemodule
v8.11.5Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License:BSD-2-ClauseImports:26Imported by:14,234

Details

Repository

github.com/go-redis/redis

Links

README

Redis client for Go

build workflowPkgGoDevDocumentation

go-redis is brought to you by ⭐uptrace/uptrace.Uptrace is an open source and blazingly fastdistributed tracing backend powered byOpenTelemetry and ClickHouse. Give it a star as well!

Resources

Other projects you may like:

  • Bun - fast and simple SQL client for PostgreSQL, MySQL, and SQLite.
  • BunRouter - fast and flexible HTTP router for Go.

Ecosystem

Features

Installation

go-redis supports 2 last Go versions and requires a Go version withmodules support. So make sure to initialize a Gomodule:

go mod init github.com/my/repo

And then install go-redis/v8 (notev8 in the import; omitting it is a popular mistake):

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

Quickstart

import (    "context"    "github.com/go-redis/redis/v8"    "fmt")var ctx = context.Background()func ExampleClient() {    rdb := redis.NewClient(&redis.Options{        Addr:     "localhost:6379",        Password: "", // no password set        DB:       0,  // use default DB    })    err := rdb.Set(ctx, "key", "value", 0).Err()    if err != nil {        panic(err)    }    val, err := rdb.Get(ctx, "key").Result()    if err != nil {        panic(err)    }    fmt.Println("key", val)    val2, err := rdb.Get(ctx, "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}

Look and feel

Some corner cases:

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

Run the test

go-redis will start a redis-server and run the test cases.

The paths of redis-server bin file and redis config file are defined inmain_test.go:

var (redisServerBin, _  = filepath.Abs(filepath.Join("testdata", "redis", "src", "redis-server"))redisServerConf, _ = filepath.Abs(filepath.Join("testdata", "redis", "redis.conf")))

For local testing, you can change the variables to refer to your local files, or create a soft linkto the corresponding folder for redis-server and copy the config file totestdata/redis/:

ln -s /usr/bin/redis-server ./go-redis/testdata/redis/srccp ./go-redis/testdata/redis.conf ./go-redis/testdata/redis/

Lastly, run:

go test

Contributors

Thanks to all the people who already contributed!

Documentation

Overview

Package redis implements a Redis client.

Example (CustomCommand)
Get := func(ctx context.Context, rdb *redis.Client, key string) *redis.StringCmd {cmd := redis.NewStringCmd(ctx, "get", key)rdb.Process(ctx, cmd)return cmd}v, err := Get(ctx, rdb, "key_does_not_exist").Result()fmt.Printf("%q %s", v, err)
Output:"" redis: nil
Example (CustomCommand2)
v, err := rdb.Do(ctx, "get", "key_does_not_exist").Text()fmt.Printf("%q %s", v, err)
Output:"" redis: nil
Example (Instrumentation)
rdb := redis.NewClient(&redis.Options{Addr: ":6379",})rdb.AddHook(redisHook{})rdb.Ping(ctx)
Output:starting processing: <ping: >finished processing: <ping: PONG>

Index

Examples

Constants

View Source
const KeepTTL = -1

KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.For example:

rdb.Set(ctx, key, value, redis.KeepTTL)

Nil reply returned by Redis when key does not exist.

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

TxFailedErr transaction redis failed.

Variables

View Source
var ErrClosed =pool.ErrClosed

ErrClosed performs any operation on the closed client will return this error.

Functions

funcSetLogger

func SetLogger(loggerinternal.Logging)

funcVersionadded inv8.11.3

func Version()string

Version is the current release version.

Types

typeBitCount

type BitCount struct {Start, Endint64}

typeBoolCmd

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

funcNewBoolCmd

func NewBoolCmd(ctxcontext.Context, 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)FullName

func (cmd *BoolCmd) FullName()string

func (*BoolCmd)Name

func (cmd *BoolCmd) Name()string

func (*BoolCmd)Result

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

func (*BoolCmd)SetErr

func (cmd *BoolCmd) SetErr(eerror)

func (*BoolCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *BoolCmd) SetFirstKeyPos(keyPosint8)

func (*BoolCmd)SetValadded inv8.11.4

func (cmd *BoolCmd) SetVal(valbool)

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(ctxcontext.Context, 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)FullName

func (cmd *BoolSliceCmd) FullName()string

func (*BoolSliceCmd)Name

func (cmd *BoolSliceCmd) Name()string

func (*BoolSliceCmd)Result

func (cmd *BoolSliceCmd) Result() ([]bool,error)

func (*BoolSliceCmd)SetErr

func (cmd *BoolSliceCmd) SetErr(eerror)

func (*BoolSliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *BoolSliceCmd) SetFirstKeyPos(keyPosint8)

func (*BoolSliceCmd)SetValadded inv8.11.4

func (cmd *BoolSliceCmd) SetVal(val []bool)

func (*BoolSliceCmd)String

func (cmd *BoolSliceCmd) String()string

func (*BoolSliceCmd)Val

func (cmd *BoolSliceCmd) Val() []bool

typeChannelOptionadded inv8.9.0

type ChannelOption func(c *channel)

funcWithChannelHealthCheckIntervaladded inv8.9.0

func WithChannelHealthCheckInterval(dtime.Duration)ChannelOption

WithChannelHealthCheckInterval specifies the health check interval.PubSub will ping Redis Server if it does not receive any messages within the interval.To disable health check, use zero interval.

The default is 3 seconds.

funcWithChannelSendTimeoutadded inv8.9.0

func WithChannelSendTimeout(dtime.Duration)ChannelOption

WithChannelSendTimeout specifies the channel send timeout after whichthe message is dropped.

The default is 60 seconds.

funcWithChannelSizeadded inv8.9.0

func WithChannelSize(sizeint)ChannelOption

WithChannelSize specifies the Go chan size that is used to buffer incoming messages.

The default is 100 messages.

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
err := rdb.Set(ctx, "key", "value", 0).Err()if err != nil {panic(err)}val, err := rdb.Get(ctx, "key").Result()if err != nil {panic(err)}fmt.Println("key", val)val2, err := rdb.Get(ctx, "missing_key").Result()if err == redis.Nil {fmt.Println("missing_key does not exist")} else if err != nil {panic(err)} else {fmt.Println("missing_key", val2)}
Output:key valuemissing_key does not exist

funcNewClient

func NewClient(opt *Options) *Client

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

Example
rdb := redis.NewClient(&redis.Options{Addr:     "localhost:6379", // use default AddrPassword: "",               // no password setDB:       0,                // use default DB})pong, err := rdb.Ping(ctx).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
// See http://redis.io/topics/sentinel for instructions how to// setup Redis Sentinel.rdb := redis.NewFailoverClient(&redis.FailoverOptions{MasterName:    "master",SentinelAddrs: []string{":26379"},})rdb.Ping(ctx)

func (*Client)AddHook

func (hs *Client) AddHook(hookHook)

func (Client)Append

func (c Client) Append(ctxcontext.Context, key, valuestring) *IntCmd

func (Client)BLMoveadded inv8.11.4

func (c Client) BLMove(ctxcontext.Context, source, destination, srcpos, destposstring, timeouttime.Duration,) *StringCmd

func (Client)BLPop

func (c Client) BLPop(ctxcontext.Context, timeouttime.Duration, keys ...string) *StringSliceCmd
Example
if err := rdb.RPush(ctx, "queue", "message").Err(); err != nil {panic(err)}// use `rdb.BLPop(0, "queue")` for infinite waiting timeresult, err := rdb.BLPop(ctx, 1*time.Second, "queue").Result()if err != nil {panic(err)}fmt.Println(result[0], result[1])
Output:queue message

func (Client)BRPop

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

func (Client)BRPopLPush

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

func (Client)BZPopMax

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

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

func (Client)BZPopMin

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

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

func (Client)BgRewriteAOF

func (c Client) BgRewriteAOF(ctxcontext.Context) *StatusCmd

func (Client)BgSave

func (c Client) BgSave(ctxcontext.Context) *StatusCmd

func (Client)BitCount

func (c Client) BitCount(ctxcontext.Context, keystring, bitCount *BitCount) *IntCmd

func (Client)BitField

func (c Client) BitField(ctxcontext.Context, keystring, args ...interface{}) *IntSliceCmd

func (Client)BitOpAnd

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

func (Client)BitOpNot

func (c Client) BitOpNot(ctxcontext.Context, destKeystring, keystring) *IntCmd

func (Client)BitOpOr

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

func (Client)BitOpXor

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

func (Client)BitPos

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

func (Client)ClientGetName

func (c Client) ClientGetName(ctxcontext.Context) *StringCmd

ClientGetName returns the name of the connection.

func (Client)ClientID

func (c Client) ClientID(ctxcontext.Context) *IntCmd

func (Client)ClientKill

func (c Client) ClientKill(ctxcontext.Context, ipPortstring) *StatusCmd

func (Client)ClientKillByFilter

func (c Client) ClientKillByFilter(ctxcontext.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (Client)ClientList

func (c Client) ClientList(ctxcontext.Context) *StringCmd

func (Client)ClientPause

func (c Client) ClientPause(ctxcontext.Context, durtime.Duration) *BoolCmd

func (Client)ClientUnblock

func (c Client) ClientUnblock(ctxcontext.Context, idint64) *IntCmd

func (Client)ClientUnblockWithError

func (c Client) ClientUnblockWithError(ctxcontext.Context, 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(ctxcontext.Context, slots ...int) *StatusCmd

func (Client)ClusterAddSlotsRange

func (c Client) ClusterAddSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Client)ClusterCountFailureReports

func (c Client) ClusterCountFailureReports(ctxcontext.Context, nodeIDstring) *IntCmd

func (Client)ClusterCountKeysInSlot

func (c Client) ClusterCountKeysInSlot(ctxcontext.Context, slotint) *IntCmd

func (Client)ClusterDelSlots

func (c Client) ClusterDelSlots(ctxcontext.Context, slots ...int) *StatusCmd

func (Client)ClusterDelSlotsRange

func (c Client) ClusterDelSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Client)ClusterFailover

func (c Client) ClusterFailover(ctxcontext.Context) *StatusCmd

func (Client)ClusterForget

func (c Client) ClusterForget(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Client)ClusterGetKeysInSlot

func (c Client) ClusterGetKeysInSlot(ctxcontext.Context, slotint, countint) *StringSliceCmd

func (Client)ClusterInfo

func (c Client) ClusterInfo(ctxcontext.Context) *StringCmd

func (Client)ClusterKeySlot

func (c Client) ClusterKeySlot(ctxcontext.Context, keystring) *IntCmd

func (Client)ClusterMeet

func (c Client) ClusterMeet(ctxcontext.Context, host, portstring) *StatusCmd

func (Client)ClusterNodes

func (c Client) ClusterNodes(ctxcontext.Context) *StringCmd

func (Client)ClusterReplicate

func (c Client) ClusterReplicate(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Client)ClusterResetHard

func (c Client) ClusterResetHard(ctxcontext.Context) *StatusCmd

func (Client)ClusterResetSoft

func (c Client) ClusterResetSoft(ctxcontext.Context) *StatusCmd

func (Client)ClusterSaveConfig

func (c Client) ClusterSaveConfig(ctxcontext.Context) *StatusCmd

func (Client)ClusterSlaves

func (c Client) ClusterSlaves(ctxcontext.Context, nodeIDstring) *StringSliceCmd

func (Client)ClusterSlots

func (c Client) ClusterSlots(ctxcontext.Context) *ClusterSlotsCmd

func (Client)Command

func (c Client) Command(ctxcontext.Context) *CommandsInfoCmd

func (Client)ConfigGet

func (c Client) ConfigGet(ctxcontext.Context, parameterstring) *SliceCmd

func (Client)ConfigResetStat

func (c Client) ConfigResetStat(ctxcontext.Context) *StatusCmd

func (Client)ConfigRewrite

func (c Client) ConfigRewrite(ctxcontext.Context) *StatusCmd

func (Client)ConfigSet

func (c Client) ConfigSet(ctxcontext.Context, parameter, valuestring) *StatusCmd

func (*Client)Conn

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

func (*Client)Context

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

func (Client)Copyadded inv8.11.5

func (c Client) Copy(ctxcontext.Context, sourceKey, destKeystring, dbint, replacebool) *IntCmd

func (Client)DBSize

func (c Client) DBSize(ctxcontext.Context) *IntCmd

func (Client)DebugObject

func (c Client) DebugObject(ctxcontext.Context, keystring) *StringCmd

func (Client)Decr

func (c Client) Decr(ctxcontext.Context, keystring) *IntCmd

func (Client)DecrBy

func (c Client) DecrBy(ctxcontext.Context, keystring, decrementint64) *IntCmd

func (Client)Del

func (c Client) Del(ctxcontext.Context, keys ...string) *IntCmd

func (*Client)Do

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

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

func (Client)Dump

func (c Client) Dump(ctxcontext.Context, keystring) *StringCmd

func (Client)Echo

func (c Client) Echo(ctxcontext.Context, message interface{}) *StringCmd

func (Client)Eval

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

func (Client)EvalSha

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

func (Client)Exists

func (c Client) Exists(ctxcontext.Context, keys ...string) *IntCmd

func (Client)Expire

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

func (Client)ExpireAt

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

func (Client)ExpireGTadded inv8.11.5

func (c Client) ExpireGT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Client)ExpireLTadded inv8.11.5

func (c Client) ExpireLT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Client)ExpireNXadded inv8.11.5

func (c Client) ExpireNX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Client)ExpireXXadded inv8.11.5

func (c Client) ExpireXX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Client)FlushAll

func (c Client) FlushAll(ctxcontext.Context) *StatusCmd

func (Client)FlushAllAsync

func (c Client) FlushAllAsync(ctxcontext.Context) *StatusCmd

func (Client)FlushDB

func (c Client) FlushDB(ctxcontext.Context) *StatusCmd

func (Client)FlushDBAsync

func (c Client) FlushDBAsync(ctxcontext.Context) *StatusCmd

func (Client)GeoAdd

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

func (Client)GeoDist

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

func (Client)GeoHash

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

func (Client)GeoPos

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

func (Client)GeoRadius

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

GeoRadius is a read-only GEORADIUS_RO command.

func (Client)GeoRadiusByMember

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

GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.

func (Client)GeoRadiusByMemberStore

func (c Client) GeoRadiusByMemberStore(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery,) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (Client)GeoRadiusStore

func (c Client) GeoRadiusStore(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery,) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (Client)GeoSearchadded inv8.11.1

func (c Client) GeoSearch(ctxcontext.Context, keystring, q *GeoSearchQuery) *StringSliceCmd

func (Client)GeoSearchLocationadded inv8.11.1

func (c Client) GeoSearchLocation(ctxcontext.Context, keystring, q *GeoSearchLocationQuery,) *GeoSearchLocationCmd

func (Client)GeoSearchStoreadded inv8.11.1

func (c Client) GeoSearchStore(ctxcontext.Context, key, storestring, q *GeoSearchStoreQuery) *IntCmd

func (Client)Get

func (c Client) Get(ctxcontext.Context, keystring) *StringCmd

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

func (Client)GetBit

func (c Client) GetBit(ctxcontext.Context, keystring, offsetint64) *IntCmd

func (Client)GetDeladded inv8.8.1

func (c Client) GetDel(ctxcontext.Context, keystring) *StringCmd

GetDel redis-server version >= 6.2.0.

func (Client)GetExadded inv8.8.1

func (c Client) GetEx(ctxcontext.Context, keystring, expirationtime.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist).Requires Redis >= 6.2.0.

func (Client)GetRange

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

func (Client)GetSet

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

func (Client)HDel

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

func (Client)HExists

func (c Client) HExists(ctxcontext.Context, key, fieldstring) *BoolCmd

func (Client)HGet

func (c Client) HGet(ctxcontext.Context, key, fieldstring) *StringCmd

func (Client)HGetAll

func (c Client) HGetAll(ctxcontext.Context, keystring) *StringStringMapCmd

func (Client)HIncrBy

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

func (Client)HIncrByFloat

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

func (Client)HKeys

func (c Client) HKeys(ctxcontext.Context, keystring) *StringSliceCmd

func (Client)HLen

func (c Client) HLen(ctxcontext.Context, keystring) *IntCmd

func (Client)HMGet

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

HMGet returns the values for the specified fields in the hash stored at key.It returns an interface{} to distinguish between empty string and nil value.

func (Client)HMSet

func (c Client) HMSet(ctxcontext.Context, keystring, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (Client)HRandFieldadded inv8.8.1

func (c Client) HRandField(ctxcontext.Context, keystring, countint, withValuesbool) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (Client)HScan

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

func (Client)HSet

func (c Client) HSet(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet("myhash", "key1", "value1", "key2", "value2")
  • HSet("myhash", []string{"key1", "value1", "key2", "value2"})
  • HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

Note that it requires Redis v4 for multiple field/value pairs support.

func (Client)HSetNX

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

func (Client)HVals

func (c Client) HVals(ctxcontext.Context, keystring) *StringSliceCmd

func (Client)Incr

func (c Client) Incr(ctxcontext.Context, keystring) *IntCmd
Example
result, err := rdb.Incr(ctx, "counter").Result()if err != nil {panic(err)}fmt.Println(result)
Output:1

func (Client)IncrBy

func (c Client) IncrBy(ctxcontext.Context, keystring, valueint64) *IntCmd

func (Client)IncrByFloat

func (c Client) IncrByFloat(ctxcontext.Context, keystring, valuefloat64) *FloatCmd

func (Client)Info

func (c Client) Info(ctxcontext.Context, section ...string) *StringCmd

func (Client)Keys

func (c Client) Keys(ctxcontext.Context, patternstring) *StringSliceCmd

func (Client)LIndex

func (c Client) LIndex(ctxcontext.Context, keystring, indexint64) *StringCmd

func (Client)LInsert

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

func (Client)LInsertAfter

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

func (Client)LInsertBefore

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

func (Client)LLen

func (c Client) LLen(ctxcontext.Context, keystring) *IntCmd

func (Client)LMoveadded inv8.8.1

func (c Client) LMove(ctxcontext.Context, source, destination, srcpos, destposstring) *StringCmd

func (Client)LPop

func (c Client) LPop(ctxcontext.Context, keystring) *StringCmd

func (Client)LPopCountadded inv8.8.3

func (c Client) LPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Client)LPosadded inv8.3.4

func (c Client) LPos(ctxcontext.Context, keystring, valuestring, aLPosArgs) *IntCmd

func (Client)LPosCountadded inv8.3.4

func (c Client) LPosCount(ctxcontext.Context, keystring, valuestring, countint64, aLPosArgs) *IntSliceCmd

func (Client)LPush

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

func (Client)LPushX

func (c Client) LPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Client)LRange

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

func (Client)LRem

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

func (Client)LSet

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

func (Client)LTrim

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

func (Client)LastSave

func (c Client) LastSave(ctxcontext.Context) *IntCmd

func (Client)MGet

func (c Client) MGet(ctxcontext.Context, keys ...string) *SliceCmd

func (Client)MSet

func (c Client) MSet(ctxcontext.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Client)MSetNX

func (c Client) MSetNX(ctxcontext.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Client)MemoryUsage

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

func (Client)Migrate

func (c Client) Migrate(ctxcontext.Context, host, port, keystring, dbint, timeouttime.Duration) *StatusCmd

func (Client)Move

func (c Client) Move(ctxcontext.Context, keystring, dbint) *BoolCmd

func (Client)ObjectEncoding

func (c Client) ObjectEncoding(ctxcontext.Context, keystring) *StringCmd

func (Client)ObjectIdleTime

func (c Client) ObjectIdleTime(ctxcontext.Context, keystring) *DurationCmd

func (Client)ObjectRefCount

func (c Client) ObjectRefCount(ctxcontext.Context, 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(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Client)PExpireAt

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

func (Client)PFAdd

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

func (Client)PFCount

func (c Client) PFCount(ctxcontext.Context, keys ...string) *IntCmd

func (Client)PFMerge

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

func (*Client)PSubscribe

func (c *Client) PSubscribe(ctxcontext.Context, 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(ctxcontext.Context, keystring) *DurationCmd

func (Client)Persist

func (c Client) Persist(ctxcontext.Context, keystring) *BoolCmd

func (Client)Ping

func (c Client) Ping(ctxcontext.Context) *StatusCmd

func (*Client)Pipeline

func (c *Client) Pipeline()Pipeliner
Example
pipe := rdb.Pipeline()incr := pipe.Incr(ctx, "pipeline_counter")pipe.Expire(ctx, "pipeline_counter", time.Hour)// Execute////     INCR pipeline_counter//     EXPIRE pipeline_counts 3600//// using one rdb-server roundtrip._, err := pipe.Exec(ctx)fmt.Println(incr.Val(), err)
Output:1 <nil>

func (*Client)Pipelined

func (c *Client) Pipelined(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)
Example
var incr *redis.IntCmd_, err := rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {incr = pipe.Incr(ctx, "pipelined_counter")pipe.Expire(ctx, "pipelined_counter", time.Hour)return nil})fmt.Println(incr.Val(), err)
Output:1 <nil>

func (*Client)PoolStats

func (c *Client) PoolStats() *PoolStats

PoolStats returns connection pool stats.

func (*Client)Process

func (c *Client) Process(ctxcontext.Context, cmdCmder)error

func (Client)PubSubChannels

func (c Client) PubSubChannels(ctxcontext.Context, patternstring) *StringSliceCmd

func (Client)PubSubNumPat

func (c Client) PubSubNumPat(ctxcontext.Context) *IntCmd

func (Client)PubSubNumSub

func (c Client) PubSubNumSub(ctxcontext.Context, channels ...string) *StringIntMapCmd

func (Client)Publish

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

Publish posts the message to the channel.

func (Client)Quit

func (c Client) Quit(_context.Context) *StatusCmd

func (Client)RPop

func (c Client) RPop(ctxcontext.Context, keystring) *StringCmd

func (Client)RPopCountadded inv8.11.1

func (c Client) RPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Client)RPopLPush

func (c Client) RPopLPush(ctxcontext.Context, source, destinationstring) *StringCmd

func (Client)RPush

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

func (Client)RPushX

func (c Client) RPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Client)RandomKey

func (c Client) RandomKey(ctxcontext.Context) *StringCmd

func (Client)ReadOnly

func (c Client) ReadOnly(ctxcontext.Context) *StatusCmd

func (Client)ReadWrite

func (c Client) ReadWrite(ctxcontext.Context) *StatusCmd

func (Client)Rename

func (c Client) Rename(ctxcontext.Context, key, newkeystring) *StatusCmd

func (Client)RenameNX

func (c Client) RenameNX(ctxcontext.Context, key, newkeystring) *BoolCmd

func (Client)Restore

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

func (Client)RestoreReplace

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

func (Client)SAdd

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

func (Client)SCard

func (c Client) SCard(ctxcontext.Context, keystring) *IntCmd

func (Client)SDiff

func (c Client) SDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Client)SDiffStore

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

func (Client)SInter

func (c Client) SInter(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Client)SInterStore

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

func (Client)SIsMember

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

func (Client)SMIsMemberadded inv8.8.3

func (c Client) SMIsMember(ctxcontext.Context, keystring, members ...interface{}) *BoolSliceCmd

SMIsMember Redis `SMISMEMBER key member [member ...]` command.

func (Client)SMembers

func (c Client) SMembers(ctxcontext.Context, keystring) *StringSliceCmd

SMembers Redis `SMEMBERS key` command output as a slice.

func (Client)SMembersMap

func (c Client) SMembersMap(ctxcontext.Context, keystring) *StringStructMapCmd

SMembersMap Redis `SMEMBERS key` command output as a map.

func (Client)SMove

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

func (Client)SPop

func (c Client) SPop(ctxcontext.Context, keystring) *StringCmd

SPop Redis `SPOP key` command.

func (Client)SPopN

func (c Client) SPopN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SPopN Redis `SPOP key count` command.

func (Client)SRandMember

func (c Client) SRandMember(ctxcontext.Context, keystring) *StringCmd

SRandMember Redis `SRANDMEMBER key` command.

func (Client)SRandMemberN

func (c Client) SRandMemberN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SRandMemberN Redis `SRANDMEMBER key count` command.

func (Client)SRem

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

func (Client)SScan

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

func (Client)SUnion

func (c Client) SUnion(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Client)SUnionStore

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

func (Client)Save

func (c Client) Save(ctxcontext.Context) *StatusCmd

func (Client)Scan

func (c Client) Scan(ctxcontext.Context, cursoruint64, matchstring, countint64) *ScanCmd
Example
rdb.FlushDB(ctx)for i := 0; i < 33; i++ {err := rdb.Set(ctx, fmt.Sprintf("key%d", i), "value", 0).Err()if err != nil {panic(err)}}var cursor uint64var n intfor {var keys []stringvar err errorkeys, cursor, err = rdb.Scan(ctx, cursor, "key*", 10).Result()if err != nil {panic(err)}n += len(keys)if cursor == 0 {break}}fmt.Printf("found %d keys\n", n)
Output:found 33 keys

func (Client)ScanTypeadded inv8.4.7

func (c Client) ScanType(ctxcontext.Context, cursoruint64, matchstring, countint64, keyTypestring) *ScanCmd
Example
rdb.FlushDB(ctx)for i := 0; i < 33; i++ {err := rdb.Set(ctx, fmt.Sprintf("key%d", i), "value", 0).Err()if err != nil {panic(err)}}var cursor uint64var n intfor {var keys []stringvar err errorkeys, cursor, err = rdb.ScanType(ctx, cursor, "key*", 10, "string").Result()if err != nil {panic(err)}n += len(keys)if cursor == 0 {break}}fmt.Printf("found %d keys\n", n)
Output:found 33 keys

func (Client)ScriptExists

func (c Client) ScriptExists(ctxcontext.Context, hashes ...string) *BoolSliceCmd

func (Client)ScriptFlush

func (c Client) ScriptFlush(ctxcontext.Context) *StatusCmd

func (Client)ScriptKill

func (c Client) ScriptKill(ctxcontext.Context) *StatusCmd

func (Client)ScriptLoad

func (c Client) ScriptLoad(ctxcontext.Context, scriptstring) *StringCmd

func (Client)Set

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

Set Redis `SET key value [expiration]` command.Use expiration for `SETEX`-like behavior.

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

Example
// Last argument is expiration. Zero means the key has no// expiration time.err := rdb.Set(ctx, "key", "value", 0).Err()if err != nil {panic(err)}// key2 will expire in an hour.err = rdb.Set(ctx, "key2", "value", time.Hour).Err()if err != nil {panic(err)}

func (Client)SetArgsadded inv8.6.0

func (c Client) SetArgs(ctxcontext.Context, keystring, value interface{}, aSetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports.It is the alternative to the Set function when you wantto have more control over the options.

func (Client)SetBit

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

func (Client)SetEXadded inv8.3.3

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

SetEX Redis `SETEX key expiration value` command.

Example
err := rdb.SetEX(ctx, "key", "value", time.Hour).Err()if err != nil {panic(err)}

func (Client)SetNX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Client)SetRange

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

func (Client)SetXX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Client)Shutdown

func (c Client) Shutdown(ctxcontext.Context) *StatusCmd

func (Client)ShutdownNoSave

func (c Client) ShutdownNoSave(ctxcontext.Context) *StatusCmd

func (Client)ShutdownSave

func (c Client) ShutdownSave(ctxcontext.Context) *StatusCmd

func (Client)SlaveOf

func (c Client) SlaveOf(ctxcontext.Context, host, portstring) *StatusCmd

func (Client)SlowLogGet

func (c Client) SlowLogGet(ctxcontext.Context, numint64) *SlowLogCmd
Example
const key = "slowlog-log-slower-than"old := rdb.ConfigGet(ctx, key).Val()rdb.ConfigSet(ctx, key, "0")defer rdb.ConfigSet(ctx, key, old[1].(string))if err := rdb.Do(ctx, "slowlog", "reset").Err(); err != nil {panic(err)}rdb.Set(ctx, "test", "true", 0)result, err := rdb.SlowLogGet(ctx, -1).Result()if err != nil {panic(err)}fmt.Println(len(result))
Output:2

func (Client)Sort

func (c Client) Sort(ctxcontext.Context, keystring, sort *Sort) *StringSliceCmd

func (Client)SortInterfaces

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

func (Client)SortStore

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

func (Client)StrLen

func (c Client) StrLen(ctxcontext.Context, keystring) *IntCmd

func (Client)String

func (c Client) String()string

func (*Client)Subscribe

func (c *Client) Subscribe(ctxcontext.Context, 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(_context.Context)

func (Client)TTL

func (c Client) TTL(ctxcontext.Context, keystring) *DurationCmd

func (Client)Time

func (c Client) Time(ctxcontext.Context) *TimeCmd

func (Client)Touch

func (c Client) Touch(ctxcontext.Context, keys ...string) *IntCmd

func (*Client)TxPipeline

func (c *Client) TxPipeline()Pipeliner

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

Example
pipe := rdb.TxPipeline()incr := pipe.Incr(ctx, "tx_pipeline_counter")pipe.Expire(ctx, "tx_pipeline_counter", time.Hour)// Execute////     MULTI//     INCR pipeline_counter//     EXPIRE pipeline_counts 3600//     EXEC//// using one rdb-server roundtrip._, err := pipe.Exec(ctx)fmt.Println(incr.Val(), err)
Output:1 <nil>

func (*Client)TxPipelined

func (c *Client) TxPipelined(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)
Example
var incr *redis.IntCmd_, err := rdb.TxPipelined(ctx, func(pipe redis.Pipeliner) error {incr = pipe.Incr(ctx, "tx_pipelined_counter")pipe.Expire(ctx, "tx_pipelined_counter", time.Hour)return nil})fmt.Println(incr.Val(), err)
Output:1 <nil>

func (Client)Type

func (c Client) Type(ctxcontext.Context, keystring) *StatusCmd

func (Client)Unlink

func (c Client) Unlink(ctxcontext.Context, keys ...string) *IntCmd

func (Client)Wait

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

func (*Client)Watch

func (c *Client) Watch(ctxcontext.Context, 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
const maxRetries = 1000// Increment transactionally increments key using GET and SET commands.increment := func(key string) error {// Transactional function.txf := func(tx *redis.Tx) error {// Get current value or zero.n, err := tx.Get(ctx, key).Int()if err != nil && err != redis.Nil {return err}// Actual opperation (local in optimistic lock).n++// Operation is committed only if the watched keys remain unchanged._, err = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {pipe.Set(ctx, key, n, 0)return nil})return err}for i := 0; i < maxRetries; i++ {err := rdb.Watch(ctx, txf, key)if err == nil {// Success.return nil}if err == redis.TxFailedErr {// Optimistic lock lost. Retry.continue}// Return any other error.return err}return errors.New("increment reached maximum number of retries")}var wg sync.WaitGroupfor i := 0; i < 100; i++ {wg.Add(1)go func() {defer wg.Done()if err := increment("counter3"); err != nil {fmt.Println("increment error:", err)}}()}wg.Wait()n, err := rdb.Get(ctx, "counter3").Int()fmt.Println("ended with", n, err)
Output:ended with 100 <nil>
Example (Instrumentation)
rdb := redis.NewClient(&redis.Options{Addr: ":6379",})rdb.AddHook(redisHook{})rdb.Watch(ctx, func(tx *redis.Tx) error {tx.Ping(ctx)tx.Ping(ctx)return nil}, "foo")
Output:starting processing: <watch foo: >finished processing: <watch foo: OK>starting processing: <ping: >finished processing: <ping: PONG>starting processing: <ping: >finished processing: <ping: PONG>starting processing: <unwatch: >finished processing: <unwatch: OK>

func (*Client)WithContext

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

func (*Client)WithTimeout

func (c *Client) WithTimeout(timeouttime.Duration) *Client

func (Client)XAck

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

func (Client)XAdd

func (c Client) XAdd(ctxcontext.Context, a *XAddArgs) *StringCmd

XAdd a.Limit has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046

func (Client)XAutoClaimadded inv8.11.0

func (c Client) XAutoClaim(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimCmd

func (Client)XAutoClaimJustIDadded inv8.11.0

func (c Client) XAutoClaimJustID(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd

func (Client)XClaim

func (c Client) XClaim(ctxcontext.Context, a *XClaimArgs) *XMessageSliceCmd

func (Client)XClaimJustID

func (c Client) XClaimJustID(ctxcontext.Context, a *XClaimArgs) *StringSliceCmd

func (Client)XDel

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

func (Client)XGroupCreate

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

func (Client)XGroupCreateConsumeradded inv8.11.0

func (c Client) XGroupCreateConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmd

func (Client)XGroupCreateMkStream

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

func (Client)XGroupDelConsumer

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

func (Client)XGroupDestroy

func (c Client) XGroupDestroy(ctxcontext.Context, stream, groupstring) *IntCmd

func (Client)XGroupSetID

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

func (Client)XInfoConsumersadded inv8.6.0

func (c Client) XInfoConsumers(ctxcontext.Context, keystring, groupstring) *XInfoConsumersCmd

func (Client)XInfoGroups

func (c Client) XInfoGroups(ctxcontext.Context, keystring) *XInfoGroupsCmd

func (Client)XInfoStreamadded inv8.2.1

func (c Client) XInfoStream(ctxcontext.Context, keystring) *XInfoStreamCmd

func (Client)XInfoStreamFulladded inv8.9.0

func (c Client) XInfoStreamFull(ctxcontext.Context, keystring, countint) *XInfoStreamFullCmd

XInfoStreamFull XINFO STREAM FULL [COUNT count]redis-server >= 6.0.

func (Client)XLen

func (c Client) XLen(ctxcontext.Context, streamstring) *IntCmd

func (Client)XPending

func (c Client) XPending(ctxcontext.Context, stream, groupstring) *XPendingCmd

func (Client)XPendingExt

func (c Client) XPendingExt(ctxcontext.Context, a *XPendingExtArgs) *XPendingExtCmd

func (Client)XRange

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

func (Client)XRangeN

func (c Client) XRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmd

func (Client)XRead

func (c Client) XRead(ctxcontext.Context, a *XReadArgs) *XStreamSliceCmd

func (Client)XReadGroup

func (c Client) XReadGroup(ctxcontext.Context, a *XReadGroupArgs) *XStreamSliceCmd

func (Client)XReadStreams

func (c Client) XReadStreams(ctxcontext.Context, streams ...string) *XStreamSliceCmd

func (Client)XRevRange

func (c Client) XRevRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmd

func (Client)XRevRangeN

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

func (Client)XTrimdeprecated

func (c Client) XTrim(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLen, remove in v9.

func (Client)XTrimApproxdeprecated

func (c Client) XTrimApprox(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLenApprox, remove in v9.

func (Client)XTrimMaxLenadded inv8.11.0

func (c Client) XTrimMaxLen(ctxcontext.Context, keystring, maxLenint64) *IntCmd

XTrimMaxLen No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MAXLEN maxLen

func (Client)XTrimMaxLenApproxadded inv8.11.0

func (c Client) XTrimMaxLenApprox(ctxcontext.Context, keystring, maxLen, limitint64) *IntCmd

XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit

func (Client)XTrimMinIDadded inv8.11.0

func (c Client) XTrimMinID(ctxcontext.Context, keystring, minIDstring) *IntCmd

XTrimMinID No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MINID minID

func (Client)XTrimMinIDApproxadded inv8.11.0

func (c Client) XTrimMinIDApprox(ctxcontext.Context, keystring, minIDstring, limitint64) *IntCmd

XTrimMinIDApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MINID ~ minID LIMIT limit

func (Client)ZAdd

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

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

func (Client)ZAddArgsadded inv8.11.0

func (c Client) ZAddArgs(ctxcontext.Context, keystring, argsZAddArgs) *IntCmd

func (Client)ZAddArgsIncradded inv8.11.0

func (c Client) ZAddArgsIncr(ctxcontext.Context, keystring, argsZAddArgs) *FloatCmd

func (Client)ZAddCh

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

ZAddCh Redis `ZADD key CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{Ch: true,Members: []Z,})remove in v9.

func (Client)ZAddNX

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

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

func (Client)ZAddNXCh

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

ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{NX: true,Ch: true,Members: []Z,})remove in v9.

func (Client)ZAddXX

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

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

func (Client)ZAddXXCh

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

ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{XX: true,Ch: true,Members: []Z,})remove in v9.

func (Client)ZCard

func (c Client) ZCard(ctxcontext.Context, keystring) *IntCmd

func (Client)ZCount

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

func (Client)ZDiffadded inv8.9.0

func (c Client) ZDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

ZDiff redis-server version >= 6.2.0.

func (Client)ZDiffStoreadded inv8.10.0

func (c Client) ZDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

ZDiffStore redis-server version >=6.2.0.

func (Client)ZDiffWithScoresadded inv8.9.0

func (c Client) ZDiffWithScores(ctxcontext.Context, keys ...string) *ZSliceCmd

ZDiffWithScores redis-server version >= 6.2.0.

func (Client)ZIncr

func (c Client) ZIncr(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncr Redis `ZADD key INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{Members: []Z,})remove in v9.

func (Client)ZIncrBy

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

func (Client)ZIncrNX

func (c Client) ZIncrNX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrNX Redis `ZADD key NX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{NX: true,Members: []Z,})remove in v9.

func (Client)ZIncrXX

func (c Client) ZIncrXX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrXX Redis `ZADD key XX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{XX: true,Members: []Z,})remove in v9.

func (Client)ZInteradded inv8.10.0

func (c Client) ZInter(ctxcontext.Context, store *ZStore) *StringSliceCmd

func (Client)ZInterStore

func (c Client) ZInterStore(ctxcontext.Context, destinationstring, store *ZStore) *IntCmd

func (Client)ZInterWithScoresadded inv8.10.0

func (c Client) ZInterWithScores(ctxcontext.Context, store *ZStore) *ZSliceCmd

func (Client)ZLexCount

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

func (Client)ZMScoreadded inv8.8.0

func (c Client) ZMScore(ctxcontext.Context, keystring, members ...string) *FloatSliceCmd

func (Client)ZPopMax

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

func (Client)ZPopMin

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

func (Client)ZRandMemberadded inv8.8.1

func (c Client) ZRandMember(ctxcontext.Context, keystring, countint, withScoresbool) *StringSliceCmd

ZRandMember redis-server version >= 6.2.0.

func (Client)ZRange

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

func (Client)ZRangeArgsadded inv8.11.0

func (c Client) ZRangeArgs(ctxcontext.Context, zZRangeArgs) *StringSliceCmd

func (Client)ZRangeArgsWithScoresadded inv8.11.0

func (c Client) ZRangeArgsWithScores(ctxcontext.Context, zZRangeArgs) *ZSliceCmd

func (Client)ZRangeByLex

func (c Client) ZRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Client)ZRangeByScore

func (c Client) ZRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Client)ZRangeByScoreWithScores

func (c Client) ZRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Client)ZRangeStoreadded inv8.11.0

func (c Client) ZRangeStore(ctxcontext.Context, dststring, zZRangeArgs) *IntCmd

func (Client)ZRangeWithScores

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

func (Client)ZRank

func (c Client) ZRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Client)ZRem

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

func (Client)ZRemRangeByLex

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

func (Client)ZRemRangeByRank

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

func (Client)ZRemRangeByScore

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

func (Client)ZRevRange

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

func (Client)ZRevRangeByLex

func (c Client) ZRevRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Client)ZRevRangeByScore

func (c Client) ZRevRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Client)ZRevRangeByScoreWithScores

func (c Client) ZRevRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Client)ZRevRangeWithScores

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

func (Client)ZRevRank

func (c Client) ZRevRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Client)ZScan

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

func (Client)ZScore

func (c Client) ZScore(ctxcontext.Context, key, memberstring) *FloatCmd

func (Client)ZUnionadded inv8.11.0

func (c Client) ZUnion(ctxcontext.Context, storeZStore) *StringSliceCmd

func (Client)ZUnionStore

func (c Client) ZUnionStore(ctxcontext.Context, deststring, store *ZStore) *IntCmd

func (Client)ZUnionWithScoresadded inv8.11.0

func (c Client) ZUnionWithScores(ctxcontext.Context, storeZStore) *ZSliceCmd

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
// See http://redis.io/topics/cluster-tutorial for instructions// how to setup Redis Cluster.rdb := redis.NewClusterClient(&redis.ClusterOptions{Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},})rdb.Ping(ctx)
Example (ManualSetup)

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

// clusterSlots returns cluster slots information.// It can use service like ZooKeeper to maintain configuration information// and Cluster.ReloadState to manually trigger state reloading.clusterSlots := func(ctx context.Context) ([]redis.ClusterSlot, error) {slots := []redis.ClusterSlot{// First node with 1 master and 1 slave.{Start: 0,End:   8191,Nodes: []redis.ClusterNode{{Addr: ":7000", // master}, {Addr: ":8000", // 1st slave}},},// Second node with 1 master and 1 slave.{Start: 8192,End:   16383,Nodes: []redis.ClusterNode{{Addr: ":7001", // master}, {Addr: ":8001", // 1st slave}},},}return slots, nil}rdb := redis.NewClusterClient(&redis.ClusterOptions{ClusterSlots:  clusterSlots,RouteRandomly: true,})rdb.Ping(ctx)// ReloadState reloads cluster state. It calls ClusterSlots func// to get cluster slots information.rdb.ReloadState(ctx)

funcNewFailoverClusterClient

func NewFailoverClusterClient(failoverOpt *FailoverOptions) *ClusterClient

NewFailoverClusterClient returns a client that supports routing read-only commandsto a slave node.

func (*ClusterClient)AddHook

func (hs *ClusterClient) AddHook(hookHook)

func (ClusterClient)Append

func (c ClusterClient) Append(ctxcontext.Context, key, valuestring) *IntCmd

func (ClusterClient)BLMoveadded inv8.11.4

func (c ClusterClient) BLMove(ctxcontext.Context, source, destination, srcpos, destposstring, timeouttime.Duration,) *StringCmd

func (ClusterClient)BLPop

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

func (ClusterClient)BRPop

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

func (ClusterClient)BRPopLPush

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

func (ClusterClient)BZPopMax

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

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

func (ClusterClient)BZPopMin

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

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

func (ClusterClient)BgRewriteAOF

func (c ClusterClient) BgRewriteAOF(ctxcontext.Context) *StatusCmd

func (ClusterClient)BgSave

func (c ClusterClient) BgSave(ctxcontext.Context) *StatusCmd

func (ClusterClient)BitCount

func (c ClusterClient) BitCount(ctxcontext.Context, keystring, bitCount *BitCount) *IntCmd

func (ClusterClient)BitField

func (c ClusterClient) BitField(ctxcontext.Context, keystring, args ...interface{}) *IntSliceCmd

func (ClusterClient)BitOpAnd

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

func (ClusterClient)BitOpNot

func (c ClusterClient) BitOpNot(ctxcontext.Context, destKeystring, keystring) *IntCmd

func (ClusterClient)BitOpOr

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

func (ClusterClient)BitOpXor

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

func (ClusterClient)BitPos

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

func (ClusterClient)ClientGetName

func (c ClusterClient) ClientGetName(ctxcontext.Context) *StringCmd

ClientGetName returns the name of the connection.

func (ClusterClient)ClientID

func (c ClusterClient) ClientID(ctxcontext.Context) *IntCmd

func (ClusterClient)ClientKill

func (c ClusterClient) ClientKill(ctxcontext.Context, ipPortstring) *StatusCmd

func (ClusterClient)ClientKillByFilter

func (c ClusterClient) ClientKillByFilter(ctxcontext.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (ClusterClient)ClientList

func (c ClusterClient) ClientList(ctxcontext.Context) *StringCmd

func (ClusterClient)ClientPause

func (c ClusterClient) ClientPause(ctxcontext.Context, durtime.Duration) *BoolCmd

func (ClusterClient)ClientUnblock

func (c ClusterClient) ClientUnblock(ctxcontext.Context, idint64) *IntCmd

func (ClusterClient)ClientUnblockWithError

func (c ClusterClient) ClientUnblockWithError(ctxcontext.Context, 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(ctxcontext.Context, slots ...int) *StatusCmd

func (ClusterClient)ClusterAddSlotsRange

func (c ClusterClient) ClusterAddSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (ClusterClient)ClusterCountFailureReports

func (c ClusterClient) ClusterCountFailureReports(ctxcontext.Context, nodeIDstring) *IntCmd

func (ClusterClient)ClusterCountKeysInSlot

func (c ClusterClient) ClusterCountKeysInSlot(ctxcontext.Context, slotint) *IntCmd

func (ClusterClient)ClusterDelSlots

func (c ClusterClient) ClusterDelSlots(ctxcontext.Context, slots ...int) *StatusCmd

func (ClusterClient)ClusterDelSlotsRange

func (c ClusterClient) ClusterDelSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (ClusterClient)ClusterFailover

func (c ClusterClient) ClusterFailover(ctxcontext.Context) *StatusCmd

func (ClusterClient)ClusterForget

func (c ClusterClient) ClusterForget(ctxcontext.Context, nodeIDstring) *StatusCmd

func (ClusterClient)ClusterGetKeysInSlot

func (c ClusterClient) ClusterGetKeysInSlot(ctxcontext.Context, slotint, countint) *StringSliceCmd

func (ClusterClient)ClusterInfo

func (c ClusterClient) ClusterInfo(ctxcontext.Context) *StringCmd

func (ClusterClient)ClusterKeySlot

func (c ClusterClient) ClusterKeySlot(ctxcontext.Context, keystring) *IntCmd

func (ClusterClient)ClusterMeet

func (c ClusterClient) ClusterMeet(ctxcontext.Context, host, portstring) *StatusCmd

func (ClusterClient)ClusterNodes

func (c ClusterClient) ClusterNodes(ctxcontext.Context) *StringCmd

func (ClusterClient)ClusterReplicate

func (c ClusterClient) ClusterReplicate(ctxcontext.Context, nodeIDstring) *StatusCmd

func (ClusterClient)ClusterResetHard

func (c ClusterClient) ClusterResetHard(ctxcontext.Context) *StatusCmd

func (ClusterClient)ClusterResetSoft

func (c ClusterClient) ClusterResetSoft(ctxcontext.Context) *StatusCmd

func (ClusterClient)ClusterSaveConfig

func (c ClusterClient) ClusterSaveConfig(ctxcontext.Context) *StatusCmd

func (ClusterClient)ClusterSlaves

func (c ClusterClient) ClusterSlaves(ctxcontext.Context, nodeIDstring) *StringSliceCmd

func (ClusterClient)ClusterSlots

func (c ClusterClient) ClusterSlots(ctxcontext.Context) *ClusterSlotsCmd

func (ClusterClient)Command

func (c ClusterClient) Command(ctxcontext.Context) *CommandsInfoCmd

func (ClusterClient)ConfigGet

func (c ClusterClient) ConfigGet(ctxcontext.Context, parameterstring) *SliceCmd

func (ClusterClient)ConfigResetStat

func (c ClusterClient) ConfigResetStat(ctxcontext.Context) *StatusCmd

func (ClusterClient)ConfigRewrite

func (c ClusterClient) ConfigRewrite(ctxcontext.Context) *StatusCmd

func (ClusterClient)ConfigSet

func (c ClusterClient) ConfigSet(ctxcontext.Context, parameter, valuestring) *StatusCmd

func (*ClusterClient)Context

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

func (ClusterClient)Copyadded inv8.11.5

func (c ClusterClient) Copy(ctxcontext.Context, sourceKey, destKeystring, dbint, replacebool) *IntCmd

func (*ClusterClient)DBSize

func (c *ClusterClient) DBSize(ctxcontext.Context) *IntCmd

func (ClusterClient)DebugObject

func (c ClusterClient) DebugObject(ctxcontext.Context, keystring) *StringCmd

func (ClusterClient)Decr

func (c ClusterClient) Decr(ctxcontext.Context, keystring) *IntCmd

func (ClusterClient)DecrBy

func (c ClusterClient) DecrBy(ctxcontext.Context, keystring, decrementint64) *IntCmd

func (ClusterClient)Del

func (c ClusterClient) Del(ctxcontext.Context, keys ...string) *IntCmd

func (*ClusterClient)Do

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

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

func (ClusterClient)Dump

func (c ClusterClient) Dump(ctxcontext.Context, keystring) *StringCmd

func (ClusterClient)Echo

func (c ClusterClient) Echo(ctxcontext.Context, message interface{}) *StringCmd

func (ClusterClient)Eval

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

func (ClusterClient)EvalSha

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

func (ClusterClient)Exists

func (c ClusterClient) Exists(ctxcontext.Context, keys ...string) *IntCmd

func (ClusterClient)Expire

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

func (ClusterClient)ExpireAt

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

func (ClusterClient)ExpireGTadded inv8.11.5

func (c ClusterClient) ExpireGT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (ClusterClient)ExpireLTadded inv8.11.5

func (c ClusterClient) ExpireLT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (ClusterClient)ExpireNXadded inv8.11.5

func (c ClusterClient) ExpireNX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (ClusterClient)ExpireXXadded inv8.11.5

func (c ClusterClient) ExpireXX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (ClusterClient)FlushAll

func (c ClusterClient) FlushAll(ctxcontext.Context) *StatusCmd

func (ClusterClient)FlushAllAsync

func (c ClusterClient) FlushAllAsync(ctxcontext.Context) *StatusCmd

func (ClusterClient)FlushDB

func (c ClusterClient) FlushDB(ctxcontext.Context) *StatusCmd

func (ClusterClient)FlushDBAsync

func (c ClusterClient) FlushDBAsync(ctxcontext.Context) *StatusCmd

func (*ClusterClient)ForEachMaster

func (c *ClusterClient) ForEachMaster(ctxcontext.Context,fn func(ctxcontext.Context, client *Client)error,)error

ForEachMaster concurrently calls the fn on each master node in the cluster.It returns the first error if any.

func (*ClusterClient)ForEachShard

func (c *ClusterClient) ForEachShard(ctxcontext.Context,fn func(ctxcontext.Context, client *Client)error,)error

ForEachShard concurrently calls the fn on each known node in the cluster.It returns the first error if any.

func (*ClusterClient)ForEachSlave

func (c *ClusterClient) ForEachSlave(ctxcontext.Context,fn func(ctxcontext.Context, client *Client)error,)error

ForEachSlave concurrently calls the fn on each slave node in the cluster.It returns the first error if any.

func (ClusterClient)GeoAdd

func (c ClusterClient) GeoAdd(ctxcontext.Context, keystring, geoLocation ...*GeoLocation) *IntCmd

func (ClusterClient)GeoDist

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

func (ClusterClient)GeoHash

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

func (ClusterClient)GeoPos

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

func (ClusterClient)GeoRadius

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

GeoRadius is a read-only GEORADIUS_RO command.

func (ClusterClient)GeoRadiusByMember

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

GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.

func (ClusterClient)GeoRadiusByMemberStore

func (c ClusterClient) GeoRadiusByMemberStore(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery,) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (ClusterClient)GeoRadiusStore

func (c ClusterClient) GeoRadiusStore(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery,) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (ClusterClient)GeoSearchadded inv8.11.1

func (c ClusterClient) GeoSearch(ctxcontext.Context, keystring, q *GeoSearchQuery) *StringSliceCmd

func (ClusterClient)GeoSearchLocationadded inv8.11.1

func (c ClusterClient) GeoSearchLocation(ctxcontext.Context, keystring, q *GeoSearchLocationQuery,) *GeoSearchLocationCmd

func (ClusterClient)GeoSearchStoreadded inv8.11.1

func (c ClusterClient) GeoSearchStore(ctxcontext.Context, key, storestring, q *GeoSearchStoreQuery) *IntCmd

func (ClusterClient)Get

func (c ClusterClient) Get(ctxcontext.Context, keystring) *StringCmd

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

func (ClusterClient)GetBit

func (c ClusterClient) GetBit(ctxcontext.Context, keystring, offsetint64) *IntCmd

func (ClusterClient)GetDeladded inv8.8.1

func (c ClusterClient) GetDel(ctxcontext.Context, keystring) *StringCmd

GetDel redis-server version >= 6.2.0.

func (ClusterClient)GetExadded inv8.8.1

func (c ClusterClient) GetEx(ctxcontext.Context, keystring, expirationtime.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist).Requires Redis >= 6.2.0.

func (ClusterClient)GetRange

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

func (ClusterClient)GetSet

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

func (ClusterClient)HDel

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

func (ClusterClient)HExists

func (c ClusterClient) HExists(ctxcontext.Context, key, fieldstring) *BoolCmd

func (ClusterClient)HGet

func (c ClusterClient) HGet(ctxcontext.Context, key, fieldstring) *StringCmd

func (ClusterClient)HGetAll

func (c ClusterClient) HGetAll(ctxcontext.Context, keystring) *StringStringMapCmd

func (ClusterClient)HIncrBy

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

func (ClusterClient)HIncrByFloat

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

func (ClusterClient)HKeys

func (c ClusterClient) HKeys(ctxcontext.Context, keystring) *StringSliceCmd

func (ClusterClient)HLen

func (c ClusterClient) HLen(ctxcontext.Context, keystring) *IntCmd

func (ClusterClient)HMGet

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

HMGet returns the values for the specified fields in the hash stored at key.It returns an interface{} to distinguish between empty string and nil value.

func (ClusterClient)HMSet

func (c ClusterClient) HMSet(ctxcontext.Context, keystring, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (ClusterClient)HRandFieldadded inv8.8.1

func (c ClusterClient) HRandField(ctxcontext.Context, keystring, countint, withValuesbool) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (ClusterClient)HScan

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

func (ClusterClient)HSet

func (c ClusterClient) HSet(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet("myhash", "key1", "value1", "key2", "value2")
  • HSet("myhash", []string{"key1", "value1", "key2", "value2"})
  • HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

Note that it requires Redis v4 for multiple field/value pairs support.

func (ClusterClient)HSetNX

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

func (ClusterClient)HVals

func (c ClusterClient) HVals(ctxcontext.Context, keystring) *StringSliceCmd

func (ClusterClient)Incr

func (c ClusterClient) Incr(ctxcontext.Context, keystring) *IntCmd

func (ClusterClient)IncrBy

func (c ClusterClient) IncrBy(ctxcontext.Context, keystring, valueint64) *IntCmd

func (ClusterClient)IncrByFloat

func (c ClusterClient) IncrByFloat(ctxcontext.Context, keystring, valuefloat64) *FloatCmd

func (ClusterClient)Info

func (c ClusterClient) Info(ctxcontext.Context, section ...string) *StringCmd

func (ClusterClient)Keys

func (c ClusterClient) Keys(ctxcontext.Context, patternstring) *StringSliceCmd

func (ClusterClient)LIndex

func (c ClusterClient) LIndex(ctxcontext.Context, keystring, indexint64) *StringCmd

func (ClusterClient)LInsert

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

func (ClusterClient)LInsertAfter

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

func (ClusterClient)LInsertBefore

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

func (ClusterClient)LLen

func (c ClusterClient) LLen(ctxcontext.Context, keystring) *IntCmd

func (ClusterClient)LMoveadded inv8.8.1

func (c ClusterClient) LMove(ctxcontext.Context, source, destination, srcpos, destposstring) *StringCmd

func (ClusterClient)LPop

func (c ClusterClient) LPop(ctxcontext.Context, keystring) *StringCmd

func (ClusterClient)LPopCountadded inv8.8.3

func (c ClusterClient) LPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (ClusterClient)LPosadded inv8.3.4

func (c ClusterClient) LPos(ctxcontext.Context, keystring, valuestring, aLPosArgs) *IntCmd

func (ClusterClient)LPosCountadded inv8.3.4

func (c ClusterClient) LPosCount(ctxcontext.Context, keystring, valuestring, countint64, aLPosArgs) *IntSliceCmd

func (ClusterClient)LPush

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

func (ClusterClient)LPushX

func (c ClusterClient) LPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (ClusterClient)LRange

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

func (ClusterClient)LRem

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

func (ClusterClient)LSet

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

func (ClusterClient)LTrim

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

func (ClusterClient)LastSave

func (c ClusterClient) LastSave(ctxcontext.Context) *IntCmd

func (ClusterClient)MGet

func (c ClusterClient) MGet(ctxcontext.Context, keys ...string) *SliceCmd

func (ClusterClient)MSet

func (c ClusterClient) MSet(ctxcontext.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (ClusterClient)MSetNX

func (c ClusterClient) MSetNX(ctxcontext.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (*ClusterClient)MasterForKeyadded inv8.4.3

func (c *ClusterClient) MasterForKey(ctxcontext.Context, keystring) (*Client,error)

MasterForKey return a client to the master node for a particular key.

func (ClusterClient)MemoryUsage

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

func (ClusterClient)Migrate

func (c ClusterClient) Migrate(ctxcontext.Context, host, port, keystring, dbint, timeouttime.Duration) *StatusCmd

func (ClusterClient)Move

func (c ClusterClient) Move(ctxcontext.Context, keystring, dbint) *BoolCmd

func (ClusterClient)ObjectEncoding

func (c ClusterClient) ObjectEncoding(ctxcontext.Context, keystring) *StringCmd

func (ClusterClient)ObjectIdleTime

func (c ClusterClient) ObjectIdleTime(ctxcontext.Context, keystring) *DurationCmd

func (ClusterClient)ObjectRefCount

func (c ClusterClient) ObjectRefCount(ctxcontext.Context, 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(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (ClusterClient)PExpireAt

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

func (ClusterClient)PFAdd

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

func (ClusterClient)PFCount

func (c ClusterClient) PFCount(ctxcontext.Context, keys ...string) *IntCmd

func (ClusterClient)PFMerge

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

func (*ClusterClient)PSubscribe

func (c *ClusterClient) PSubscribe(ctxcontext.Context, channels ...string) *PubSub

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

func (ClusterClient)PTTL

func (c ClusterClient) PTTL(ctxcontext.Context, keystring) *DurationCmd

func (ClusterClient)Persist

func (c ClusterClient) Persist(ctxcontext.Context, keystring) *BoolCmd

func (ClusterClient)Ping

func (c ClusterClient) Ping(ctxcontext.Context) *StatusCmd

func (*ClusterClient)Pipeline

func (c *ClusterClient) Pipeline()Pipeliner

func (*ClusterClient)Pipelined

func (c *ClusterClient) Pipelined(ctxcontext.Context, 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(ctxcontext.Context, cmdCmder)error

func (ClusterClient)PubSubChannels

func (c ClusterClient) PubSubChannels(ctxcontext.Context, patternstring) *StringSliceCmd

func (ClusterClient)PubSubNumPat

func (c ClusterClient) PubSubNumPat(ctxcontext.Context) *IntCmd

func (ClusterClient)PubSubNumSub

func (c ClusterClient) PubSubNumSub(ctxcontext.Context, channels ...string) *StringIntMapCmd

func (ClusterClient)Publish

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

Publish posts the message to the channel.

func (ClusterClient)Quit

func (c ClusterClient) Quit(_context.Context) *StatusCmd

func (ClusterClient)RPop

func (c ClusterClient) RPop(ctxcontext.Context, keystring) *StringCmd

func (ClusterClient)RPopCountadded inv8.11.1

func (c ClusterClient) RPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (ClusterClient)RPopLPush

func (c ClusterClient) RPopLPush(ctxcontext.Context, source, destinationstring) *StringCmd

func (ClusterClient)RPush

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

func (ClusterClient)RPushX

func (c ClusterClient) RPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (ClusterClient)RandomKey

func (c ClusterClient) RandomKey(ctxcontext.Context) *StringCmd

func (ClusterClient)ReadOnly

func (c ClusterClient) ReadOnly(ctxcontext.Context) *StatusCmd

func (ClusterClient)ReadWrite

func (c ClusterClient) ReadWrite(ctxcontext.Context) *StatusCmd

func (*ClusterClient)ReloadState

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

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

func (ClusterClient)Rename

func (c ClusterClient) Rename(ctxcontext.Context, key, newkeystring) *StatusCmd

func (ClusterClient)RenameNX

func (c ClusterClient) RenameNX(ctxcontext.Context, key, newkeystring) *BoolCmd

func (ClusterClient)Restore

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

func (ClusterClient)RestoreReplace

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

func (ClusterClient)SAdd

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

func (ClusterClient)SCard

func (c ClusterClient) SCard(ctxcontext.Context, keystring) *IntCmd

func (ClusterClient)SDiff

func (c ClusterClient) SDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

func (ClusterClient)SDiffStore

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

func (ClusterClient)SInter

func (c ClusterClient) SInter(ctxcontext.Context, keys ...string) *StringSliceCmd

func (ClusterClient)SInterStore

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

func (ClusterClient)SIsMember

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

func (ClusterClient)SMIsMemberadded inv8.8.3

func (c ClusterClient) SMIsMember(ctxcontext.Context, keystring, members ...interface{}) *BoolSliceCmd

SMIsMember Redis `SMISMEMBER key member [member ...]` command.

func (ClusterClient)SMembers

func (c ClusterClient) SMembers(ctxcontext.Context, keystring) *StringSliceCmd

SMembers Redis `SMEMBERS key` command output as a slice.

func (ClusterClient)SMembersMap

func (c ClusterClient) SMembersMap(ctxcontext.Context, keystring) *StringStructMapCmd

SMembersMap Redis `SMEMBERS key` command output as a map.

func (ClusterClient)SMove

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

func (ClusterClient)SPop

func (c ClusterClient) SPop(ctxcontext.Context, keystring) *StringCmd

SPop Redis `SPOP key` command.

func (ClusterClient)SPopN

func (c ClusterClient) SPopN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SPopN Redis `SPOP key count` command.

func (ClusterClient)SRandMember

func (c ClusterClient) SRandMember(ctxcontext.Context, keystring) *StringCmd

SRandMember Redis `SRANDMEMBER key` command.

func (ClusterClient)SRandMemberN

func (c ClusterClient) SRandMemberN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SRandMemberN Redis `SRANDMEMBER key count` command.

func (ClusterClient)SRem

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

func (ClusterClient)SScan

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

func (ClusterClient)SUnion

func (c ClusterClient) SUnion(ctxcontext.Context, keys ...string) *StringSliceCmd

func (ClusterClient)SUnionStore

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

func (ClusterClient)Save

func (c ClusterClient) Save(ctxcontext.Context) *StatusCmd

func (ClusterClient)Scan

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

func (ClusterClient)ScanTypeadded inv8.4.7

func (c ClusterClient) ScanType(ctxcontext.Context, cursoruint64, matchstring, countint64, keyTypestring) *ScanCmd

func (*ClusterClient)ScriptExists

func (c *ClusterClient) ScriptExists(ctxcontext.Context, hashes ...string) *BoolSliceCmd

func (*ClusterClient)ScriptFlush

func (c *ClusterClient) ScriptFlush(ctxcontext.Context) *StatusCmd

func (ClusterClient)ScriptKill

func (c ClusterClient) ScriptKill(ctxcontext.Context) *StatusCmd

func (*ClusterClient)ScriptLoad

func (c *ClusterClient) ScriptLoad(ctxcontext.Context, scriptstring) *StringCmd

func (ClusterClient)Set

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

Set Redis `SET key value [expiration]` command.Use expiration for `SETEX`-like behavior.

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (ClusterClient)SetArgsadded inv8.6.0

func (c ClusterClient) SetArgs(ctxcontext.Context, keystring, value interface{}, aSetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports.It is the alternative to the Set function when you wantto have more control over the options.

func (ClusterClient)SetBit

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

func (ClusterClient)SetEXadded inv8.3.3

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

SetEX Redis `SETEX key expiration value` command.

func (ClusterClient)SetNX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (ClusterClient)SetRange

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

func (ClusterClient)SetXX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (ClusterClient)Shutdown

func (c ClusterClient) Shutdown(ctxcontext.Context) *StatusCmd

func (ClusterClient)ShutdownNoSave

func (c ClusterClient) ShutdownNoSave(ctxcontext.Context) *StatusCmd

func (ClusterClient)ShutdownSave

func (c ClusterClient) ShutdownSave(ctxcontext.Context) *StatusCmd

func (*ClusterClient)SlaveForKeyadded inv8.4.4

func (c *ClusterClient) SlaveForKey(ctxcontext.Context, keystring) (*Client,error)

SlaveForKey gets a client for a replica node to run any command on it.This is especially useful if we want to run a particular lua script which hasonly read only commands on the replica.This is because other redis commands generally have a flag that points thatthey are read only and automatically run on the replica nodesif ClusterOptions.ReadOnly flag is set to true.

func (ClusterClient)SlaveOf

func (c ClusterClient) SlaveOf(ctxcontext.Context, host, portstring) *StatusCmd

func (ClusterClient)SlowLogGet

func (c ClusterClient) SlowLogGet(ctxcontext.Context, numint64) *SlowLogCmd

func (ClusterClient)Sort

func (c ClusterClient) Sort(ctxcontext.Context, keystring, sort *Sort) *StringSliceCmd

func (ClusterClient)SortInterfaces

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

func (ClusterClient)SortStore

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

func (ClusterClient)StrLen

func (c ClusterClient) StrLen(ctxcontext.Context, keystring) *IntCmd

func (*ClusterClient)Subscribe

func (c *ClusterClient) Subscribe(ctxcontext.Context, 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(_context.Context)

func (ClusterClient)TTL

func (c ClusterClient) TTL(ctxcontext.Context, keystring) *DurationCmd

func (ClusterClient)Time

func (c ClusterClient) Time(ctxcontext.Context) *TimeCmd

func (ClusterClient)Touch

func (c ClusterClient) Touch(ctxcontext.Context, 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(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)

func (ClusterClient)Type

func (c ClusterClient) Type(ctxcontext.Context, keystring) *StatusCmd

func (ClusterClient)Unlink

func (c ClusterClient) Unlink(ctxcontext.Context, keys ...string) *IntCmd

func (ClusterClient)Wait

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

func (*ClusterClient)Watch

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

func (*ClusterClient)WithContext

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

func (ClusterClient)XAck

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

func (ClusterClient)XAdd

func (c ClusterClient) XAdd(ctxcontext.Context, a *XAddArgs) *StringCmd

XAdd a.Limit has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046

func (ClusterClient)XAutoClaimadded inv8.11.0

func (c ClusterClient) XAutoClaim(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimCmd

func (ClusterClient)XAutoClaimJustIDadded inv8.11.0

func (c ClusterClient) XAutoClaimJustID(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd

func (ClusterClient)XClaim

func (c ClusterClient) XClaim(ctxcontext.Context, a *XClaimArgs) *XMessageSliceCmd

func (ClusterClient)XClaimJustID

func (c ClusterClient) XClaimJustID(ctxcontext.Context, a *XClaimArgs) *StringSliceCmd

func (ClusterClient)XDel

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

func (ClusterClient)XGroupCreate

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

func (ClusterClient)XGroupCreateConsumeradded inv8.11.0

func (c ClusterClient) XGroupCreateConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmd

func (ClusterClient)XGroupCreateMkStream

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

func (ClusterClient)XGroupDelConsumer

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

func (ClusterClient)XGroupDestroy

func (c ClusterClient) XGroupDestroy(ctxcontext.Context, stream, groupstring) *IntCmd

func (ClusterClient)XGroupSetID

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

func (ClusterClient)XInfoConsumersadded inv8.6.0

func (c ClusterClient) XInfoConsumers(ctxcontext.Context, keystring, groupstring) *XInfoConsumersCmd

func (ClusterClient)XInfoGroups

func (c ClusterClient) XInfoGroups(ctxcontext.Context, keystring) *XInfoGroupsCmd

func (ClusterClient)XInfoStreamadded inv8.2.1

func (c ClusterClient) XInfoStream(ctxcontext.Context, keystring) *XInfoStreamCmd

func (ClusterClient)XInfoStreamFulladded inv8.9.0

func (c ClusterClient) XInfoStreamFull(ctxcontext.Context, keystring, countint) *XInfoStreamFullCmd

XInfoStreamFull XINFO STREAM FULL [COUNT count]redis-server >= 6.0.

func (ClusterClient)XLen

func (c ClusterClient) XLen(ctxcontext.Context, streamstring) *IntCmd

func (ClusterClient)XPending

func (c ClusterClient) XPending(ctxcontext.Context, stream, groupstring) *XPendingCmd

func (ClusterClient)XPendingExt

func (c ClusterClient) XPendingExt(ctxcontext.Context, a *XPendingExtArgs) *XPendingExtCmd

func (ClusterClient)XRange

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

func (ClusterClient)XRangeN

func (c ClusterClient) XRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmd

func (ClusterClient)XRead

func (c ClusterClient) XRead(ctxcontext.Context, a *XReadArgs) *XStreamSliceCmd

func (ClusterClient)XReadGroup

func (c ClusterClient) XReadGroup(ctxcontext.Context, a *XReadGroupArgs) *XStreamSliceCmd

func (ClusterClient)XReadStreams

func (c ClusterClient) XReadStreams(ctxcontext.Context, streams ...string) *XStreamSliceCmd

func (ClusterClient)XRevRange

func (c ClusterClient) XRevRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmd

func (ClusterClient)XRevRangeN

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

func (ClusterClient)XTrimdeprecated

func (c ClusterClient) XTrim(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLen, remove in v9.

func (ClusterClient)XTrimApproxdeprecated

func (c ClusterClient) XTrimApprox(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLenApprox, remove in v9.

func (ClusterClient)XTrimMaxLenadded inv8.11.0

func (c ClusterClient) XTrimMaxLen(ctxcontext.Context, keystring, maxLenint64) *IntCmd

XTrimMaxLen No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MAXLEN maxLen

func (ClusterClient)XTrimMaxLenApproxadded inv8.11.0

func (c ClusterClient) XTrimMaxLenApprox(ctxcontext.Context, keystring, maxLen, limitint64) *IntCmd

XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit

func (ClusterClient)XTrimMinIDadded inv8.11.0

func (c ClusterClient) XTrimMinID(ctxcontext.Context, keystring, minIDstring) *IntCmd

XTrimMinID No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MINID minID

func (ClusterClient)XTrimMinIDApproxadded inv8.11.0

func (c ClusterClient) XTrimMinIDApprox(ctxcontext.Context, keystring, minIDstring, limitint64) *IntCmd

XTrimMinIDApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MINID ~ minID LIMIT limit

func (ClusterClient)ZAdd

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

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

func (ClusterClient)ZAddArgsadded inv8.11.0

func (c ClusterClient) ZAddArgs(ctxcontext.Context, keystring, argsZAddArgs) *IntCmd

func (ClusterClient)ZAddArgsIncradded inv8.11.0

func (c ClusterClient) ZAddArgsIncr(ctxcontext.Context, keystring, argsZAddArgs) *FloatCmd

func (ClusterClient)ZAddCh

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

ZAddCh Redis `ZADD key CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{Ch: true,Members: []Z,})remove in v9.

func (ClusterClient)ZAddNX

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

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

func (ClusterClient)ZAddNXCh

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

ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{NX: true,Ch: true,Members: []Z,})remove in v9.

func (ClusterClient)ZAddXX

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

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

func (ClusterClient)ZAddXXCh

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

ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{XX: true,Ch: true,Members: []Z,})remove in v9.

func (ClusterClient)ZCard

func (c ClusterClient) ZCard(ctxcontext.Context, keystring) *IntCmd

func (ClusterClient)ZCount

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

func (ClusterClient)ZDiffadded inv8.9.0

func (c ClusterClient) ZDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

ZDiff redis-server version >= 6.2.0.

func (ClusterClient)ZDiffStoreadded inv8.10.0

func (c ClusterClient) ZDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

ZDiffStore redis-server version >=6.2.0.

func (ClusterClient)ZDiffWithScoresadded inv8.9.0

func (c ClusterClient) ZDiffWithScores(ctxcontext.Context, keys ...string) *ZSliceCmd

ZDiffWithScores redis-server version >= 6.2.0.

func (ClusterClient)ZIncr

func (c ClusterClient) ZIncr(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncr Redis `ZADD key INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{Members: []Z,})remove in v9.

func (ClusterClient)ZIncrBy

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

func (ClusterClient)ZIncrNX

func (c ClusterClient) ZIncrNX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrNX Redis `ZADD key NX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{NX: true,Members: []Z,})remove in v9.

func (ClusterClient)ZIncrXX

func (c ClusterClient) ZIncrXX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrXX Redis `ZADD key XX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{XX: true,Members: []Z,})remove in v9.

func (ClusterClient)ZInteradded inv8.10.0

func (c ClusterClient) ZInter(ctxcontext.Context, store *ZStore) *StringSliceCmd

func (ClusterClient)ZInterStore

func (c ClusterClient) ZInterStore(ctxcontext.Context, destinationstring, store *ZStore) *IntCmd

func (ClusterClient)ZInterWithScoresadded inv8.10.0

func (c ClusterClient) ZInterWithScores(ctxcontext.Context, store *ZStore) *ZSliceCmd

func (ClusterClient)ZLexCount

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

func (ClusterClient)ZMScoreadded inv8.8.0

func (c ClusterClient) ZMScore(ctxcontext.Context, keystring, members ...string) *FloatSliceCmd

func (ClusterClient)ZPopMax

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

func (ClusterClient)ZPopMin

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

func (ClusterClient)ZRandMemberadded inv8.8.1

func (c ClusterClient) ZRandMember(ctxcontext.Context, keystring, countint, withScoresbool) *StringSliceCmd

ZRandMember redis-server version >= 6.2.0.

func (ClusterClient)ZRange

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

func (ClusterClient)ZRangeArgsadded inv8.11.0

func (c ClusterClient) ZRangeArgs(ctxcontext.Context, zZRangeArgs) *StringSliceCmd

func (ClusterClient)ZRangeArgsWithScoresadded inv8.11.0

func (c ClusterClient) ZRangeArgsWithScores(ctxcontext.Context, zZRangeArgs) *ZSliceCmd

func (ClusterClient)ZRangeByLex

func (c ClusterClient) ZRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (ClusterClient)ZRangeByScore

func (c ClusterClient) ZRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (ClusterClient)ZRangeByScoreWithScores

func (c ClusterClient) ZRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (ClusterClient)ZRangeStoreadded inv8.11.0

func (c ClusterClient) ZRangeStore(ctxcontext.Context, dststring, zZRangeArgs) *IntCmd

func (ClusterClient)ZRangeWithScores

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

func (ClusterClient)ZRank

func (c ClusterClient) ZRank(ctxcontext.Context, key, memberstring) *IntCmd

func (ClusterClient)ZRem

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

func (ClusterClient)ZRemRangeByLex

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

func (ClusterClient)ZRemRangeByRank

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

func (ClusterClient)ZRemRangeByScore

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

func (ClusterClient)ZRevRange

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

func (ClusterClient)ZRevRangeByLex

func (c ClusterClient) ZRevRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (ClusterClient)ZRevRangeByScore

func (c ClusterClient) ZRevRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (ClusterClient)ZRevRangeByScoreWithScores

func (c ClusterClient) ZRevRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (ClusterClient)ZRevRangeWithScores

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

func (ClusterClient)ZRevRank

func (c ClusterClient) ZRevRank(ctxcontext.Context, key, memberstring) *IntCmd

func (ClusterClient)ZScan

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

func (ClusterClient)ZScore

func (c ClusterClient) ZScore(ctxcontext.Context, key, memberstring) *FloatCmd

func (ClusterClient)ZUnionadded inv8.11.0

func (c ClusterClient) ZUnion(ctxcontext.Context, storeZStore) *StringSliceCmd

func (ClusterClient)ZUnionStore

func (c ClusterClient) ZUnionStore(ctxcontext.Context, deststring, store *ZStore) *IntCmd

func (ClusterClient)ZUnionWithScoresadded inv8.11.0

func (c ClusterClient) ZUnionWithScores(ctxcontext.Context, storeZStore) *ZSliceCmd

typeClusterNode

type ClusterNode struct {IDstringAddrstring}

typeClusterOptions

type ClusterOptions struct {// A seed list of host:port addresses of cluster nodes.Addrs []string// NewClient creates a cluster node client with provided name and options.NewClient func(opt *Options) *Client// The maximum number of retries before giving up. Command is retried// on network errors and MOVED/ASK redirects.// Default is 3 retries.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(context.Context) ([]ClusterSlot,error)Dialer func(ctxcontext.Context, network, addrstring) (net.Conn,error)OnConnect func(ctxcontext.Context, cn *Conn)errorUsernamestringPasswordstringMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.Duration// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).PoolFIFObool// 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(ctxcontext.Context, 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)FullName

func (cmd *ClusterSlotsCmd) FullName()string

func (*ClusterSlotsCmd)Name

func (cmd *ClusterSlotsCmd) Name()string

func (*ClusterSlotsCmd)Result

func (cmd *ClusterSlotsCmd) Result() ([]ClusterSlot,error)

func (*ClusterSlotsCmd)SetErr

func (cmd *ClusterSlotsCmd) SetErr(eerror)

func (*ClusterSlotsCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *ClusterSlotsCmd) SetFirstKeyPos(keyPosint8)

func (*ClusterSlotsCmd)SetValadded inv8.11.4

func (cmd *ClusterSlotsCmd) SetVal(val []ClusterSlot)

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(ctxcontext.Context, 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)BoolSliceadded inv8.11.4

func (cmd *Cmd) BoolSlice() ([]bool,error)

func (*Cmd)Err

func (cmd *Cmd) Err()error

func (*Cmd)Float32

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

func (*Cmd)Float32Sliceadded inv8.11.4

func (cmd *Cmd) Float32Slice() ([]float32,error)

func (*Cmd)Float64

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

func (*Cmd)Float64Sliceadded inv8.11.4

func (cmd *Cmd) Float64Slice() ([]float64,error)

func (*Cmd)FullName

func (cmd *Cmd) FullName()string

func (*Cmd)Int

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

func (*Cmd)Int64

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

func (*Cmd)Int64Sliceadded inv8.11.4

func (cmd *Cmd) Int64Slice() ([]int64,error)

func (*Cmd)Name

func (cmd *Cmd) Name()string

func (*Cmd)Result

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

func (*Cmd)SetErr

func (cmd *Cmd) SetErr(eerror)

func (*Cmd)SetFirstKeyPosadded inv8.11.5

func (cmd *Cmd) SetFirstKeyPos(keyPosint8)

func (*Cmd)SetValadded inv8.11.4

func (cmd *Cmd) SetVal(val interface{})

func (*Cmd)Sliceadded inv8.11.4

func (cmd *Cmd) Slice() ([]interface{},error)

func (*Cmd)String

func (cmd *Cmd) String()string

func (*Cmd)StringSliceadded inv8.11.4

func (cmd *Cmd) StringSlice() ([]string,error)

func (*Cmd)Text

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

func (*Cmd)Uint64

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

func (*Cmd)Uint64Sliceadded inv8.11.4

func (cmd *Cmd) Uint64Slice() ([]uint64,error)

func (*Cmd)Val

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

typeCmdable

type Cmdable interface {Pipeline()PipelinerPipelined(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)TxPipelined(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)TxPipeline()PipelinerCommand(ctxcontext.Context) *CommandsInfoCmdClientGetName(ctxcontext.Context) *StringCmdEcho(ctxcontext.Context, message interface{}) *StringCmdPing(ctxcontext.Context) *StatusCmdQuit(ctxcontext.Context) *StatusCmdDel(ctxcontext.Context, keys ...string) *IntCmdUnlink(ctxcontext.Context, keys ...string) *IntCmdDump(ctxcontext.Context, keystring) *StringCmdExists(ctxcontext.Context, keys ...string) *IntCmdExpire(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmdExpireAt(ctxcontext.Context, keystring, tmtime.Time) *BoolCmdExpireNX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmdExpireXX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmdExpireGT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmdExpireLT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmdKeys(ctxcontext.Context, patternstring) *StringSliceCmdMigrate(ctxcontext.Context, host, port, keystring, dbint, timeouttime.Duration) *StatusCmdMove(ctxcontext.Context, keystring, dbint) *BoolCmdObjectRefCount(ctxcontext.Context, keystring) *IntCmdObjectEncoding(ctxcontext.Context, keystring) *StringCmdObjectIdleTime(ctxcontext.Context, keystring) *DurationCmdPersist(ctxcontext.Context, keystring) *BoolCmdPExpire(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmdPExpireAt(ctxcontext.Context, keystring, tmtime.Time) *BoolCmdPTTL(ctxcontext.Context, keystring) *DurationCmdRandomKey(ctxcontext.Context) *StringCmdRename(ctxcontext.Context, key, newkeystring) *StatusCmdRenameNX(ctxcontext.Context, key, newkeystring) *BoolCmdRestore(ctxcontext.Context, keystring, ttltime.Duration, valuestring) *StatusCmdRestoreReplace(ctxcontext.Context, keystring, ttltime.Duration, valuestring) *StatusCmdSort(ctxcontext.Context, keystring, sort *Sort) *StringSliceCmdSortStore(ctxcontext.Context, key, storestring, sort *Sort) *IntCmdSortInterfaces(ctxcontext.Context, keystring, sort *Sort) *SliceCmdTouch(ctxcontext.Context, keys ...string) *IntCmdTTL(ctxcontext.Context, keystring) *DurationCmdType(ctxcontext.Context, keystring) *StatusCmdAppend(ctxcontext.Context, key, valuestring) *IntCmdDecr(ctxcontext.Context, keystring) *IntCmdDecrBy(ctxcontext.Context, keystring, decrementint64) *IntCmdGet(ctxcontext.Context, keystring) *StringCmdGetRange(ctxcontext.Context, keystring, start, endint64) *StringCmdGetSet(ctxcontext.Context, keystring, value interface{}) *StringCmdGetEx(ctxcontext.Context, keystring, expirationtime.Duration) *StringCmdGetDel(ctxcontext.Context, keystring) *StringCmdIncr(ctxcontext.Context, keystring) *IntCmdIncrBy(ctxcontext.Context, keystring, valueint64) *IntCmdIncrByFloat(ctxcontext.Context, keystring, valuefloat64) *FloatCmdMGet(ctxcontext.Context, keys ...string) *SliceCmdMSet(ctxcontext.Context, values ...interface{}) *StatusCmdMSetNX(ctxcontext.Context, values ...interface{}) *BoolCmdSet(ctxcontext.Context, keystring, value interface{}, expirationtime.Duration) *StatusCmdSetArgs(ctxcontext.Context, keystring, value interface{}, aSetArgs) *StatusCmd// TODO: rename to SetExSetEX(ctxcontext.Context, keystring, value interface{}, expirationtime.Duration) *StatusCmdSetNX(ctxcontext.Context, keystring, value interface{}, expirationtime.Duration) *BoolCmdSetXX(ctxcontext.Context, keystring, value interface{}, expirationtime.Duration) *BoolCmdSetRange(ctxcontext.Context, keystring, offsetint64, valuestring) *IntCmdStrLen(ctxcontext.Context, keystring) *IntCmdCopy(ctxcontext.Context, sourceKeystring, destKeystring, dbint, replacebool) *IntCmdGetBit(ctxcontext.Context, keystring, offsetint64) *IntCmdSetBit(ctxcontext.Context, keystring, offsetint64, valueint) *IntCmdBitCount(ctxcontext.Context, keystring, bitCount *BitCount) *IntCmdBitOpAnd(ctxcontext.Context, destKeystring, keys ...string) *IntCmdBitOpOr(ctxcontext.Context, destKeystring, keys ...string) *IntCmdBitOpXor(ctxcontext.Context, destKeystring, keys ...string) *IntCmdBitOpNot(ctxcontext.Context, destKeystring, keystring) *IntCmdBitPos(ctxcontext.Context, keystring, bitint64, pos ...int64) *IntCmdBitField(ctxcontext.Context, keystring, args ...interface{}) *IntSliceCmdScan(ctxcontext.Context, cursoruint64, matchstring, countint64) *ScanCmdScanType(ctxcontext.Context, cursoruint64, matchstring, countint64, keyTypestring) *ScanCmdSScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmdHScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmdZScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmdHDel(ctxcontext.Context, keystring, fields ...string) *IntCmdHExists(ctxcontext.Context, key, fieldstring) *BoolCmdHGet(ctxcontext.Context, key, fieldstring) *StringCmdHGetAll(ctxcontext.Context, keystring) *StringStringMapCmdHIncrBy(ctxcontext.Context, key, fieldstring, incrint64) *IntCmdHIncrByFloat(ctxcontext.Context, key, fieldstring, incrfloat64) *FloatCmdHKeys(ctxcontext.Context, keystring) *StringSliceCmdHLen(ctxcontext.Context, keystring) *IntCmdHMGet(ctxcontext.Context, keystring, fields ...string) *SliceCmdHSet(ctxcontext.Context, keystring, values ...interface{}) *IntCmdHMSet(ctxcontext.Context, keystring, values ...interface{}) *BoolCmdHSetNX(ctxcontext.Context, key, fieldstring, value interface{}) *BoolCmdHVals(ctxcontext.Context, keystring) *StringSliceCmdHRandField(ctxcontext.Context, keystring, countint, withValuesbool) *StringSliceCmdBLPop(ctxcontext.Context, timeouttime.Duration, keys ...string) *StringSliceCmdBRPop(ctxcontext.Context, timeouttime.Duration, keys ...string) *StringSliceCmdBRPopLPush(ctxcontext.Context, source, destinationstring, timeouttime.Duration) *StringCmdLIndex(ctxcontext.Context, keystring, indexint64) *StringCmdLInsert(ctxcontext.Context, key, opstring, pivot, value interface{}) *IntCmdLInsertBefore(ctxcontext.Context, keystring, pivot, value interface{}) *IntCmdLInsertAfter(ctxcontext.Context, keystring, pivot, value interface{}) *IntCmdLLen(ctxcontext.Context, keystring) *IntCmdLPop(ctxcontext.Context, keystring) *StringCmdLPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmdLPos(ctxcontext.Context, keystring, valuestring, argsLPosArgs) *IntCmdLPosCount(ctxcontext.Context, keystring, valuestring, countint64, argsLPosArgs) *IntSliceCmdLPush(ctxcontext.Context, keystring, values ...interface{}) *IntCmdLPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmdLRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmdLRem(ctxcontext.Context, keystring, countint64, value interface{}) *IntCmdLSet(ctxcontext.Context, keystring, indexint64, value interface{}) *StatusCmdLTrim(ctxcontext.Context, keystring, start, stopint64) *StatusCmdRPop(ctxcontext.Context, keystring) *StringCmdRPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmdRPopLPush(ctxcontext.Context, source, destinationstring) *StringCmdRPush(ctxcontext.Context, keystring, values ...interface{}) *IntCmdRPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmdLMove(ctxcontext.Context, source, destination, srcpos, destposstring) *StringCmdBLMove(ctxcontext.Context, source, destination, srcpos, destposstring, timeouttime.Duration) *StringCmdSAdd(ctxcontext.Context, keystring, members ...interface{}) *IntCmdSCard(ctxcontext.Context, keystring) *IntCmdSDiff(ctxcontext.Context, keys ...string) *StringSliceCmdSDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmdSInter(ctxcontext.Context, keys ...string) *StringSliceCmdSInterStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmdSIsMember(ctxcontext.Context, keystring, member interface{}) *BoolCmdSMIsMember(ctxcontext.Context, keystring, members ...interface{}) *BoolSliceCmdSMembers(ctxcontext.Context, keystring) *StringSliceCmdSMembersMap(ctxcontext.Context, keystring) *StringStructMapCmdSMove(ctxcontext.Context, source, destinationstring, member interface{}) *BoolCmdSPop(ctxcontext.Context, keystring) *StringCmdSPopN(ctxcontext.Context, keystring, countint64) *StringSliceCmdSRandMember(ctxcontext.Context, keystring) *StringCmdSRandMemberN(ctxcontext.Context, keystring, countint64) *StringSliceCmdSRem(ctxcontext.Context, keystring, members ...interface{}) *IntCmdSUnion(ctxcontext.Context, keys ...string) *StringSliceCmdSUnionStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmdXAdd(ctxcontext.Context, a *XAddArgs) *StringCmdXDel(ctxcontext.Context, streamstring, ids ...string) *IntCmdXLen(ctxcontext.Context, streamstring) *IntCmdXRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmdXRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmdXRevRange(ctxcontext.Context, streamstring, start, stopstring) *XMessageSliceCmdXRevRangeN(ctxcontext.Context, streamstring, start, stopstring, countint64) *XMessageSliceCmdXRead(ctxcontext.Context, a *XReadArgs) *XStreamSliceCmdXReadStreams(ctxcontext.Context, streams ...string) *XStreamSliceCmdXGroupCreate(ctxcontext.Context, stream, group, startstring) *StatusCmdXGroupCreateMkStream(ctxcontext.Context, stream, group, startstring) *StatusCmdXGroupSetID(ctxcontext.Context, stream, group, startstring) *StatusCmdXGroupDestroy(ctxcontext.Context, stream, groupstring) *IntCmdXGroupCreateConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmdXGroupDelConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmdXReadGroup(ctxcontext.Context, a *XReadGroupArgs) *XStreamSliceCmdXAck(ctxcontext.Context, stream, groupstring, ids ...string) *IntCmdXPending(ctxcontext.Context, stream, groupstring) *XPendingCmdXPendingExt(ctxcontext.Context, a *XPendingExtArgs) *XPendingExtCmdXClaim(ctxcontext.Context, a *XClaimArgs) *XMessageSliceCmdXClaimJustID(ctxcontext.Context, a *XClaimArgs) *StringSliceCmdXAutoClaim(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimCmdXAutoClaimJustID(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd// TODO: XTrim and XTrimApprox remove in v9.XTrim(ctxcontext.Context, keystring, maxLenint64) *IntCmdXTrimApprox(ctxcontext.Context, keystring, maxLenint64) *IntCmdXTrimMaxLen(ctxcontext.Context, keystring, maxLenint64) *IntCmdXTrimMaxLenApprox(ctxcontext.Context, keystring, maxLen, limitint64) *IntCmdXTrimMinID(ctxcontext.Context, keystring, minIDstring) *IntCmdXTrimMinIDApprox(ctxcontext.Context, keystring, minIDstring, limitint64) *IntCmdXInfoGroups(ctxcontext.Context, keystring) *XInfoGroupsCmdXInfoStream(ctxcontext.Context, keystring) *XInfoStreamCmdXInfoStreamFull(ctxcontext.Context, keystring, countint) *XInfoStreamFullCmdXInfoConsumers(ctxcontext.Context, keystring, groupstring) *XInfoConsumersCmdBZPopMax(ctxcontext.Context, timeouttime.Duration, keys ...string) *ZWithKeyCmdBZPopMin(ctxcontext.Context, timeouttime.Duration, keys ...string) *ZWithKeyCmdZAdd(ctxcontext.Context, keystring, members ...*Z) *IntCmdZAddNX(ctxcontext.Context, keystring, members ...*Z) *IntCmdZAddXX(ctxcontext.Context, keystring, members ...*Z) *IntCmdZAddCh(ctxcontext.Context, keystring, members ...*Z) *IntCmdZAddNXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmdZAddXXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmdZAddArgs(ctxcontext.Context, keystring, argsZAddArgs) *IntCmdZAddArgsIncr(ctxcontext.Context, keystring, argsZAddArgs) *FloatCmdZIncr(ctxcontext.Context, keystring, member *Z) *FloatCmdZIncrNX(ctxcontext.Context, keystring, member *Z) *FloatCmdZIncrXX(ctxcontext.Context, keystring, member *Z) *FloatCmdZCard(ctxcontext.Context, keystring) *IntCmdZCount(ctxcontext.Context, key, min, maxstring) *IntCmdZLexCount(ctxcontext.Context, key, min, maxstring) *IntCmdZIncrBy(ctxcontext.Context, keystring, incrementfloat64, memberstring) *FloatCmdZInter(ctxcontext.Context, store *ZStore) *StringSliceCmdZInterWithScores(ctxcontext.Context, store *ZStore) *ZSliceCmdZInterStore(ctxcontext.Context, destinationstring, store *ZStore) *IntCmdZMScore(ctxcontext.Context, keystring, members ...string) *FloatSliceCmdZPopMax(ctxcontext.Context, keystring, count ...int64) *ZSliceCmdZPopMin(ctxcontext.Context, keystring, count ...int64) *ZSliceCmdZRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmdZRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmdZRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmdZRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmdZRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmdZRangeArgs(ctxcontext.Context, zZRangeArgs) *StringSliceCmdZRangeArgsWithScores(ctxcontext.Context, zZRangeArgs) *ZSliceCmdZRangeStore(ctxcontext.Context, dststring, zZRangeArgs) *IntCmdZRank(ctxcontext.Context, key, memberstring) *IntCmdZRem(ctxcontext.Context, keystring, members ...interface{}) *IntCmdZRemRangeByRank(ctxcontext.Context, keystring, start, stopint64) *IntCmdZRemRangeByScore(ctxcontext.Context, key, min, maxstring) *IntCmdZRemRangeByLex(ctxcontext.Context, key, min, maxstring) *IntCmdZRevRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmdZRevRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmdZRevRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmdZRevRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmdZRevRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmdZRevRank(ctxcontext.Context, key, memberstring) *IntCmdZScore(ctxcontext.Context, key, memberstring) *FloatCmdZUnionStore(ctxcontext.Context, deststring, store *ZStore) *IntCmdZUnion(ctxcontext.Context, storeZStore) *StringSliceCmdZUnionWithScores(ctxcontext.Context, storeZStore) *ZSliceCmdZRandMember(ctxcontext.Context, keystring, countint, withScoresbool) *StringSliceCmdZDiff(ctxcontext.Context, keys ...string) *StringSliceCmdZDiffWithScores(ctxcontext.Context, keys ...string) *ZSliceCmdZDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmdPFAdd(ctxcontext.Context, keystring, els ...interface{}) *IntCmdPFCount(ctxcontext.Context, keys ...string) *IntCmdPFMerge(ctxcontext.Context, deststring, keys ...string) *StatusCmdBgRewriteAOF(ctxcontext.Context) *StatusCmdBgSave(ctxcontext.Context) *StatusCmdClientKill(ctxcontext.Context, ipPortstring) *StatusCmdClientKillByFilter(ctxcontext.Context, keys ...string) *IntCmdClientList(ctxcontext.Context) *StringCmdClientPause(ctxcontext.Context, durtime.Duration) *BoolCmdClientID(ctxcontext.Context) *IntCmdConfigGet(ctxcontext.Context, parameterstring) *SliceCmdConfigResetStat(ctxcontext.Context) *StatusCmdConfigSet(ctxcontext.Context, parameter, valuestring) *StatusCmdConfigRewrite(ctxcontext.Context) *StatusCmdDBSize(ctxcontext.Context) *IntCmdFlushAll(ctxcontext.Context) *StatusCmdFlushAllAsync(ctxcontext.Context) *StatusCmdFlushDB(ctxcontext.Context) *StatusCmdFlushDBAsync(ctxcontext.Context) *StatusCmdInfo(ctxcontext.Context, section ...string) *StringCmdLastSave(ctxcontext.Context) *IntCmdSave(ctxcontext.Context) *StatusCmdShutdown(ctxcontext.Context) *StatusCmdShutdownSave(ctxcontext.Context) *StatusCmdShutdownNoSave(ctxcontext.Context) *StatusCmdSlaveOf(ctxcontext.Context, host, portstring) *StatusCmdTime(ctxcontext.Context) *TimeCmdDebugObject(ctxcontext.Context, keystring) *StringCmdReadOnly(ctxcontext.Context) *StatusCmdReadWrite(ctxcontext.Context) *StatusCmdMemoryUsage(ctxcontext.Context, keystring, samples ...int) *IntCmdEval(ctxcontext.Context, scriptstring, keys []string, args ...interface{}) *CmdEvalSha(ctxcontext.Context, sha1string, keys []string, args ...interface{}) *CmdScriptExists(ctxcontext.Context, hashes ...string) *BoolSliceCmdScriptFlush(ctxcontext.Context) *StatusCmdScriptKill(ctxcontext.Context) *StatusCmdScriptLoad(ctxcontext.Context, scriptstring) *StringCmdPublish(ctxcontext.Context, channelstring, message interface{}) *IntCmdPubSubChannels(ctxcontext.Context, patternstring) *StringSliceCmdPubSubNumSub(ctxcontext.Context, channels ...string) *StringIntMapCmdPubSubNumPat(ctxcontext.Context) *IntCmdClusterSlots(ctxcontext.Context) *ClusterSlotsCmdClusterNodes(ctxcontext.Context) *StringCmdClusterMeet(ctxcontext.Context, host, portstring) *StatusCmdClusterForget(ctxcontext.Context, nodeIDstring) *StatusCmdClusterReplicate(ctxcontext.Context, nodeIDstring) *StatusCmdClusterResetSoft(ctxcontext.Context) *StatusCmdClusterResetHard(ctxcontext.Context) *StatusCmdClusterInfo(ctxcontext.Context) *StringCmdClusterKeySlot(ctxcontext.Context, keystring) *IntCmdClusterGetKeysInSlot(ctxcontext.Context, slotint, countint) *StringSliceCmdClusterCountFailureReports(ctxcontext.Context, nodeIDstring) *IntCmdClusterCountKeysInSlot(ctxcontext.Context, slotint) *IntCmdClusterDelSlots(ctxcontext.Context, slots ...int) *StatusCmdClusterDelSlotsRange(ctxcontext.Context, min, maxint) *StatusCmdClusterSaveConfig(ctxcontext.Context) *StatusCmdClusterSlaves(ctxcontext.Context, nodeIDstring) *StringSliceCmdClusterFailover(ctxcontext.Context) *StatusCmdClusterAddSlots(ctxcontext.Context, slots ...int) *StatusCmdClusterAddSlotsRange(ctxcontext.Context, min, maxint) *StatusCmdGeoAdd(ctxcontext.Context, keystring, geoLocation ...*GeoLocation) *IntCmdGeoPos(ctxcontext.Context, keystring, members ...string) *GeoPosCmdGeoRadius(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *GeoLocationCmdGeoRadiusStore(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery) *IntCmdGeoRadiusByMember(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery) *GeoLocationCmdGeoRadiusByMemberStore(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery) *IntCmdGeoSearch(ctxcontext.Context, keystring, q *GeoSearchQuery) *StringSliceCmdGeoSearchLocation(ctxcontext.Context, keystring, q *GeoSearchLocationQuery) *GeoSearchLocationCmdGeoSearchStore(ctxcontext.Context, key, storestring, q *GeoSearchStoreQuery) *IntCmdGeoDist(ctxcontext.Context, keystring, member1, member2, unitstring) *FloatCmdGeoHash(ctxcontext.Context, keystring, members ...string) *StringSliceCmd}

typeCmder

type Cmder interface {Name()stringFullName()stringArgs() []interface{}String()stringSetFirstKeyPos(int8)SetErr(error)Err()error// contains filtered or unexported methods}

typeCommandInfo

type CommandInfo struct {NamestringArityint8Flags       []stringACLFlags    []stringFirstKeyPosint8LastKeyPosint8StepCountint8ReadOnlybool}

typeCommandsInfoCmd

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

funcNewCommandsInfoCmd

func NewCommandsInfoCmd(ctxcontext.Context, 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)FullName

func (cmd *CommandsInfoCmd) FullName()string

func (*CommandsInfoCmd)Name

func (cmd *CommandsInfoCmd) Name()string

func (*CommandsInfoCmd)Result

func (cmd *CommandsInfoCmd) Result() (map[string]*CommandInfo,error)

func (*CommandsInfoCmd)SetErr

func (cmd *CommandsInfoCmd) SetErr(eerror)

func (*CommandsInfoCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *CommandsInfoCmd) SetFirstKeyPos(keyPosint8)

func (*CommandsInfoCmd)SetValadded inv8.11.4

func (cmd *CommandsInfoCmd) SetVal(val map[string]*CommandInfo)

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 represents a single Redis connection rather than a pool of connections.Prefer running commands from Client unless there is a specific needfor a continuous single Redis connection.

Example
conn := rdb.Conn(context.Background())err := conn.ClientSetName(ctx, "foobar").Err()if err != nil {panic(err)}// Open other connections.for i := 0; i < 10; i++ {go rdb.Ping(ctx)}s, err := conn.ClientGetName(ctx).Result()if err != nil {panic(err)}fmt.Println(s)
Output:foobar

func (*Conn)Pipeline

func (c *Conn) Pipeline()Pipeliner

func (*Conn)Pipelined

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

func (*Conn)Process

func (c *Conn) Process(ctxcontext.Context, cmdCmder)error

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(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)

typeConsistentHash

type ConsistentHash interface {Get(string)string}

typeDurationCmd

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

funcNewDurationCmd

func NewDurationCmd(ctxcontext.Context, 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)FullName

func (cmd *DurationCmd) FullName()string

func (*DurationCmd)Name

func (cmd *DurationCmd) Name()string

func (*DurationCmd)Result

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

func (*DurationCmd)SetErr

func (cmd *DurationCmd) SetErr(eerror)

func (*DurationCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *DurationCmd) SetFirstKeyPos(keyPosint8)

func (*DurationCmd)SetValadded inv8.11.4

func (cmd *DurationCmd) SetVal(valtime.Duration)

func (*DurationCmd)String

func (cmd *DurationCmd) String()string

func (*DurationCmd)Val

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

typeError

type Error interface {error// RedisError is a no-op function but// serves to distinguish types that are Redis// errors from ordinary errors: a type is a// Redis error if it has a RedisError method.RedisError()}

typeFailoverOptions

type FailoverOptions struct {// The master name.MasterNamestring// A seed list of host:port addresses of sentinel nodes.SentinelAddrs []string// If specified with SentinelPassword, enables ACL-based authentication (via// AUTH <user> <pass>).SentinelUsernamestring// Sentinel password from "requirepass <password>" (if enabled) in Sentinel// configuration, or, if SentinelUsername is also supplied, used for ACL-based// authentication.SentinelPasswordstring// Allows routing read-only commands to the closest master or slave node.// This option only works with NewFailoverClusterClient.RouteByLatencybool// Allows routing read-only commands to the random master or slave node.// This option only works with NewFailoverClusterClient.RouteRandomlybool// Route all commands to slave read-only nodes.SlaveOnlybool// Use slaves disconnected with master when cannot get connected slaves// Now, this option only works in RandomSlaveAddr function.UseDisconnectedSlavesboolDialer    func(ctxcontext.Context, network, addrstring) (net.Conn,error)OnConnect func(ctxcontext.Context, cn *Conn)errorUsernamestringPasswordstringDBintMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.Duration// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).PoolFIFOboolPoolSizeintMinIdleConnsintMaxConnAgetime.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(ctxcontext.Context, 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)FullName

func (cmd *FloatCmd) FullName()string

func (*FloatCmd)Name

func (cmd *FloatCmd) Name()string

func (*FloatCmd)Result

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

func (*FloatCmd)SetErr

func (cmd *FloatCmd) SetErr(eerror)

func (*FloatCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *FloatCmd) SetFirstKeyPos(keyPosint8)

func (*FloatCmd)SetValadded inv8.11.4

func (cmd *FloatCmd) SetVal(valfloat64)

func (*FloatCmd)String

func (cmd *FloatCmd) String()string

func (*FloatCmd)Val

func (cmd *FloatCmd) Val()float64

typeFloatSliceCmdadded inv8.8.0

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

funcNewFloatSliceCmdadded inv8.8.0

func NewFloatSliceCmd(ctxcontext.Context, args ...interface{}) *FloatSliceCmd

func (*FloatSliceCmd)Argsadded inv8.8.0

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

func (*FloatSliceCmd)Erradded inv8.8.0

func (cmd *FloatSliceCmd) Err()error

func (*FloatSliceCmd)FullNameadded inv8.8.0

func (cmd *FloatSliceCmd) FullName()string

func (*FloatSliceCmd)Nameadded inv8.8.0

func (cmd *FloatSliceCmd) Name()string

func (*FloatSliceCmd)Resultadded inv8.8.0

func (cmd *FloatSliceCmd) Result() ([]float64,error)

func (*FloatSliceCmd)SetErradded inv8.8.0

func (cmd *FloatSliceCmd) SetErr(eerror)

func (*FloatSliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *FloatSliceCmd) SetFirstKeyPos(keyPosint8)

func (*FloatSliceCmd)SetValadded inv8.11.4

func (cmd *FloatSliceCmd) SetVal(val []float64)

func (*FloatSliceCmd)Stringadded inv8.8.0

func (cmd *FloatSliceCmd) String()string

func (*FloatSliceCmd)Valadded inv8.8.0

func (cmd *FloatSliceCmd) 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(ctxcontext.Context, 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)FullName

func (cmd *GeoLocationCmd) FullName()string

func (*GeoLocationCmd)Name

func (cmd *GeoLocationCmd) Name()string

func (*GeoLocationCmd)Result

func (cmd *GeoLocationCmd) Result() ([]GeoLocation,error)

func (*GeoLocationCmd)SetErr

func (cmd *GeoLocationCmd) SetErr(eerror)

func (*GeoLocationCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *GeoLocationCmd) SetFirstKeyPos(keyPosint8)

func (*GeoLocationCmd)SetValadded inv8.11.4

func (cmd *GeoLocationCmd) SetVal(locations []GeoLocation)

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(ctxcontext.Context, args ...interface{}) *GeoPosCmd

funcNewGeoPosCmdResult

func NewGeoPosCmdResult(val []*GeoPos, errerror) *GeoPosCmd

NewGeoPosCmdResult returns a GeoPosCmd initialised with val and err for testing.

func (*GeoPosCmd)Args

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

func (*GeoPosCmd)Err

func (cmd *GeoPosCmd) Err()error

func (*GeoPosCmd)FullName

func (cmd *GeoPosCmd) FullName()string

func (*GeoPosCmd)Name

func (cmd *GeoPosCmd) Name()string

func (*GeoPosCmd)Result

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

func (*GeoPosCmd)SetErr

func (cmd *GeoPosCmd) SetErr(eerror)

func (*GeoPosCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *GeoPosCmd) SetFirstKeyPos(keyPosint8)

func (*GeoPosCmd)SetValadded inv8.11.4

func (cmd *GeoPosCmd) SetVal(val []*GeoPos)

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.

typeGeoSearchLocationCmdadded inv8.11.1

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

funcNewGeoSearchLocationCmdadded inv8.11.1

func NewGeoSearchLocationCmd(ctxcontext.Context, opt *GeoSearchLocationQuery, args ...interface{},) *GeoSearchLocationCmd

func (*GeoSearchLocationCmd)Argsadded inv8.11.1

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

func (*GeoSearchLocationCmd)Erradded inv8.11.1

func (cmd *GeoSearchLocationCmd) Err()error

func (*GeoSearchLocationCmd)FullNameadded inv8.11.1

func (cmd *GeoSearchLocationCmd) FullName()string

func (*GeoSearchLocationCmd)Nameadded inv8.11.1

func (cmd *GeoSearchLocationCmd) Name()string

func (*GeoSearchLocationCmd)Resultadded inv8.11.1

func (cmd *GeoSearchLocationCmd) Result() ([]GeoLocation,error)

func (*GeoSearchLocationCmd)SetErradded inv8.11.1

func (cmd *GeoSearchLocationCmd) SetErr(eerror)

func (*GeoSearchLocationCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *GeoSearchLocationCmd) SetFirstKeyPos(keyPosint8)

func (*GeoSearchLocationCmd)SetValadded inv8.11.4

func (cmd *GeoSearchLocationCmd) SetVal(val []GeoLocation)

func (*GeoSearchLocationCmd)Stringadded inv8.11.1

func (cmd *GeoSearchLocationCmd) String()string

func (*GeoSearchLocationCmd)Valadded inv8.11.1

func (cmd *GeoSearchLocationCmd) Val() []GeoLocation

typeGeoSearchLocationQueryadded inv8.11.1

type GeoSearchLocationQuery struct {GeoSearchQueryWithCoordboolWithDistboolWithHashbool}

typeGeoSearchQueryadded inv8.11.1

type GeoSearchQuery struct {Memberstring// Latitude and Longitude when using FromLonLat option.Longitudefloat64Latitudefloat64// Distance and unit when using ByRadius option.// Can use m, km, ft, or mi. Default is km.Radiusfloat64RadiusUnitstring// Height, width and unit when using ByBox option.// Can be m, km, ft, or mi. Default is km.BoxWidthfloat64BoxHeightfloat64BoxUnitstring// Can be ASC or DESC. Default is no sort order.SortstringCountintCountAnybool}

GeoSearchQuery is used for GEOSearch/GEOSearchStore command query.

typeGeoSearchStoreQueryadded inv8.11.1

type GeoSearchStoreQuery struct {GeoSearchQuery// When using the StoreDist option, the command stores the items in a// sorted set populated with their distance from the center of the circle or box,// as a floating-point number, in the same unit specified for that shape.StoreDistbool}

typeHook

type Hook interface {BeforeProcess(ctxcontext.Context, cmdCmder) (context.Context,error)AfterProcess(ctxcontext.Context, cmdCmder)errorBeforeProcessPipeline(ctxcontext.Context, cmds []Cmder) (context.Context,error)AfterProcessPipeline(ctxcontext.Context, cmds []Cmder)error}

typeIntCmd

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

funcNewIntCmd

func NewIntCmd(ctxcontext.Context, 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)FullName

func (cmd *IntCmd) FullName()string

func (*IntCmd)Name

func (cmd *IntCmd) Name()string

func (*IntCmd)Result

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

func (*IntCmd)SetErr

func (cmd *IntCmd) SetErr(eerror)

func (*IntCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *IntCmd) SetFirstKeyPos(keyPosint8)

func (*IntCmd)SetValadded inv8.11.4

func (cmd *IntCmd) SetVal(valint64)

func (*IntCmd)String

func (cmd *IntCmd) String()string

func (*IntCmd)Uint64

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

func (*IntCmd)Val

func (cmd *IntCmd) Val()int64

typeIntSliceCmd

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

funcNewIntSliceCmd

func NewIntSliceCmd(ctxcontext.Context, args ...interface{}) *IntSliceCmd

func (*IntSliceCmd)Args

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

func (*IntSliceCmd)Err

func (cmd *IntSliceCmd) Err()error

func (*IntSliceCmd)FullName

func (cmd *IntSliceCmd) FullName()string

func (*IntSliceCmd)Name

func (cmd *IntSliceCmd) Name()string

func (*IntSliceCmd)Result

func (cmd *IntSliceCmd) Result() ([]int64,error)

func (*IntSliceCmd)SetErr

func (cmd *IntSliceCmd) SetErr(eerror)

func (*IntSliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *IntSliceCmd) SetFirstKeyPos(keyPosint8)

func (*IntSliceCmd)SetValadded inv8.11.4

func (cmd *IntSliceCmd) SetVal(val []int64)

func (*IntSliceCmd)String

func (cmd *IntSliceCmd) String()string

func (*IntSliceCmd)Val

func (cmd *IntSliceCmd) Val() []int64

typeLPosArgsadded inv8.3.4

type LPosArgs struct {Rank, MaxLenint64}

typeLimiter

type Limiter interface {// Allow returns nil if operation is allowed or an error otherwise.// If operation is allowed client must ReportResult of the operation// whether it is a success or a failure.Allow()error// ReportResult reports the result of the previously allowed operation.// nil indicates a success, non-nil error usually indicates a failure.ReportResult(resulterror)}

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

typeMessage

type Message struct {ChannelstringPatternstringPayloadstringPayloadSlice []string}

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(ctxcontext.Context, network, addrstring) (net.Conn,error)// Hook that is called when new connection is established.OnConnect func(ctxcontext.Context, cn *Conn)error// Use the specified Username to authenticate the current connection// with one of the connections defined in the ACL list when connecting// to a Redis 6.0 instance, or greater, that is using the Redis ACL system.Usernamestring// Optional password. Must match the password specified in the// requirepass server configuration option (if connecting to a Redis 5.0 instance, or lower),// or the User Password when connecting to a Redis 6.0 instance, or greater,// that is using the Redis ACL system.Passwordstring// Database to be selected after connecting to the server.DBint// Maximum number of retries before giving up.// Default is 3 retries; -1 (not 0) disables retries.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// Type of connection pool.// true for FIFO pool, false for LIFO pool.// Note that fifo has higher overhead compared to lifo.PoolFIFObool// Maximum number of socket connections.// Default is 10 connections per every available CPU as reported by runtime.GOMAXPROCS.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// Limiter interface used to implemented circuit breaker or rate limiter.LimiterLimiter// contains filtered or unexported fields}

Options keeps the settings to setup redis connection.

funcParseURL

func ParseURL(redisURLstring) (*Options,error)

ParseURL parses an URL into Options that can be used to connect to Redis.Scheme is required.There are two connection types: by tcp socket and by unix socket.Tcp connection:

redis://<user>:<password>@<host>:<port>/<db_number>

Unix connection:

unix://<user>:<password>@</path/to/redis.sock>?db=<db_number>

Most Option fields can be set using query parameters, with the following restrictions:

  • field names are mapped using snake-case conversion: to set MaxRetries, use max_retries
  • only scalar type fields are supported (bool, int, time.Duration)
  • for time.Duration fields, values must be a valid input for time.ParseDuration();additionally a plain integer as value (i.e. without unit) is intepreted as seconds
  • to disable a duration field, use value less than or equal to 0; to use the defaultvalue, leave the value blank or remove the parameter
  • only the last value is interpreted if a parameter is given multiple times
  • fields "network", "addr", "username" and "password" can only be set using otherURL attributes (scheme, host, userinfo, resp.), query paremeters using thesenames will be treated as unknown parameters
  • unknown parameter names will result in an error

Examples:

redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2is equivalent to:&Options{Network:     "tcp",Addr:        "localhost:6789",DB:          1,               // path "/3" was overridden by "&db=1"DialTimeout: 3 * time.Second, // no time unit = secondsReadTimeout: 6 * time.Second,MaxRetries:  2,}
Example
opt, err := redis.ParseURL("redis://:qwerty@localhost:6379/1?dial_timeout=5s")if err != nil {panic(err)}fmt.Println("addr is", opt.Addr)fmt.Println("db is", opt.DB)fmt.Println("password is", opt.Password)fmt.Println("dial timeout is", opt.DialTimeout)// Create client as usually._ = redis.NewClient(opt)
Output:addr is localhost:6379db is 1password is qwertydial timeout is 5s

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)
rdb := redis.NewClient(&redis.Options{Addr: ":6379",})rdb.AddHook(redisHook{})rdb.Pipelined(ctx, func(pipe redis.Pipeliner) error {pipe.Ping(ctx)pipe.Ping(ctx)return nil})
Output:pipeline starting processing: [ping:  ping: ]pipeline finished processing: [ping: PONG ping: PONG]

func (Pipeline)Append

func (c Pipeline) Append(ctxcontext.Context, key, valuestring) *IntCmd

func (Pipeline)Auth

func (c Pipeline) Auth(ctxcontext.Context, passwordstring) *StatusCmd

func (Pipeline)AuthACL

func (c Pipeline) AuthACL(ctxcontext.Context, username, passwordstring) *StatusCmd

AuthACL Perform an AUTH command, using the given user and pass.Should be used to authenticate the current connection with one of the connections defined in the ACL listwhen connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system.

func (Pipeline)BLMoveadded inv8.11.4

func (c Pipeline) BLMove(ctxcontext.Context, source, destination, srcpos, destposstring, timeouttime.Duration,) *StringCmd

func (Pipeline)BLPop

func (c Pipeline) BLPop(ctxcontext.Context, timeouttime.Duration, keys ...string) *StringSliceCmd

func (Pipeline)BRPop

func (c Pipeline) BRPop(ctxcontext.Context, timeouttime.Duration, keys ...string) *StringSliceCmd

func (Pipeline)BRPopLPush

func (c Pipeline) BRPopLPush(ctxcontext.Context, source, destinationstring, timeouttime.Duration) *StringCmd

func (Pipeline)BZPopMax

func (c Pipeline) BZPopMax(ctxcontext.Context, timeouttime.Duration, keys ...string) *ZWithKeyCmd

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

func (Pipeline)BZPopMin

func (c Pipeline) BZPopMin(ctxcontext.Context, timeouttime.Duration, keys ...string) *ZWithKeyCmd

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

func (Pipeline)BgRewriteAOF

func (c Pipeline) BgRewriteAOF(ctxcontext.Context) *StatusCmd

func (Pipeline)BgSave

func (c Pipeline) BgSave(ctxcontext.Context) *StatusCmd

func (Pipeline)BitCount

func (c Pipeline) BitCount(ctxcontext.Context, keystring, bitCount *BitCount) *IntCmd

func (Pipeline)BitField

func (c Pipeline) BitField(ctxcontext.Context, keystring, args ...interface{}) *IntSliceCmd

func (Pipeline)BitOpAnd

func (c Pipeline) BitOpAnd(ctxcontext.Context, destKeystring, keys ...string) *IntCmd

func (Pipeline)BitOpNot

func (c Pipeline) BitOpNot(ctxcontext.Context, destKeystring, keystring) *IntCmd

func (Pipeline)BitOpOr

func (c Pipeline) BitOpOr(ctxcontext.Context, destKeystring, keys ...string) *IntCmd

func (Pipeline)BitOpXor

func (c Pipeline) BitOpXor(ctxcontext.Context, destKeystring, keys ...string) *IntCmd

func (Pipeline)BitPos

func (c Pipeline) BitPos(ctxcontext.Context, keystring, bitint64, pos ...int64) *IntCmd

func (Pipeline)ClientGetName

func (c Pipeline) ClientGetName(ctxcontext.Context) *StringCmd

ClientGetName returns the name of the connection.

func (Pipeline)ClientID

func (c Pipeline) ClientID(ctxcontext.Context) *IntCmd

func (Pipeline)ClientKill

func (c Pipeline) ClientKill(ctxcontext.Context, ipPortstring) *StatusCmd

func (Pipeline)ClientKillByFilter

func (c Pipeline) ClientKillByFilter(ctxcontext.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (Pipeline)ClientList

func (c Pipeline) ClientList(ctxcontext.Context) *StringCmd

func (Pipeline)ClientPause

func (c Pipeline) ClientPause(ctxcontext.Context, durtime.Duration) *BoolCmd

func (Pipeline)ClientSetName

func (c Pipeline) ClientSetName(ctxcontext.Context, namestring) *BoolCmd

ClientSetName assigns a name to the connection.

func (Pipeline)ClientUnblock

func (c Pipeline) ClientUnblock(ctxcontext.Context, idint64) *IntCmd

func (Pipeline)ClientUnblockWithError

func (c Pipeline) ClientUnblockWithError(ctxcontext.Context, idint64) *IntCmd

func (*Pipeline)Close

func (c *Pipeline) Close()error

Close closes the pipeline, releasing any open resources.

func (Pipeline)ClusterAddSlots

func (c Pipeline) ClusterAddSlots(ctxcontext.Context, slots ...int) *StatusCmd

func (Pipeline)ClusterAddSlotsRange

func (c Pipeline) ClusterAddSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Pipeline)ClusterCountFailureReports

func (c Pipeline) ClusterCountFailureReports(ctxcontext.Context, nodeIDstring) *IntCmd

func (Pipeline)ClusterCountKeysInSlot

func (c Pipeline) ClusterCountKeysInSlot(ctxcontext.Context, slotint) *IntCmd

func (Pipeline)ClusterDelSlots

func (c Pipeline) ClusterDelSlots(ctxcontext.Context, slots ...int) *StatusCmd

func (Pipeline)ClusterDelSlotsRange

func (c Pipeline) ClusterDelSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Pipeline)ClusterFailover

func (c Pipeline) ClusterFailover(ctxcontext.Context) *StatusCmd

func (Pipeline)ClusterForget

func (c Pipeline) ClusterForget(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Pipeline)ClusterGetKeysInSlot

func (c Pipeline) ClusterGetKeysInSlot(ctxcontext.Context, slotint, countint) *StringSliceCmd

func (Pipeline)ClusterInfo

func (c Pipeline) ClusterInfo(ctxcontext.Context) *StringCmd

func (Pipeline)ClusterKeySlot

func (c Pipeline) ClusterKeySlot(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)ClusterMeet

func (c Pipeline) ClusterMeet(ctxcontext.Context, host, portstring) *StatusCmd

func (Pipeline)ClusterNodes

func (c Pipeline) ClusterNodes(ctxcontext.Context) *StringCmd

func (Pipeline)ClusterReplicate

func (c Pipeline) ClusterReplicate(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Pipeline)ClusterResetHard

func (c Pipeline) ClusterResetHard(ctxcontext.Context) *StatusCmd

func (Pipeline)ClusterResetSoft

func (c Pipeline) ClusterResetSoft(ctxcontext.Context) *StatusCmd

func (Pipeline)ClusterSaveConfig

func (c Pipeline) ClusterSaveConfig(ctxcontext.Context) *StatusCmd

func (Pipeline)ClusterSlaves

func (c Pipeline) ClusterSlaves(ctxcontext.Context, nodeIDstring) *StringSliceCmd

func (Pipeline)ClusterSlots

func (c Pipeline) ClusterSlots(ctxcontext.Context) *ClusterSlotsCmd

func (Pipeline)Command

func (c Pipeline) Command(ctxcontext.Context) *CommandsInfoCmd

func (Pipeline)ConfigGet

func (c Pipeline) ConfigGet(ctxcontext.Context, parameterstring) *SliceCmd

func (Pipeline)ConfigResetStat

func (c Pipeline) ConfigResetStat(ctxcontext.Context) *StatusCmd

func (Pipeline)ConfigRewrite

func (c Pipeline) ConfigRewrite(ctxcontext.Context) *StatusCmd

func (Pipeline)ConfigSet

func (c Pipeline) ConfigSet(ctxcontext.Context, parameter, valuestring) *StatusCmd

func (Pipeline)Copyadded inv8.11.5

func (c Pipeline) Copy(ctxcontext.Context, sourceKey, destKeystring, dbint, replacebool) *IntCmd

func (Pipeline)DBSize

func (c Pipeline) DBSize(ctxcontext.Context) *IntCmd

func (Pipeline)DebugObject

func (c Pipeline) DebugObject(ctxcontext.Context, keystring) *StringCmd

func (Pipeline)Decr

func (c Pipeline) Decr(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)DecrBy

func (c Pipeline) DecrBy(ctxcontext.Context, keystring, decrementint64) *IntCmd

func (Pipeline)Del

func (c Pipeline) Del(ctxcontext.Context, keys ...string) *IntCmd

func (*Pipeline)Discard

func (c *Pipeline) Discard()error

Discard resets the pipeline and discards queued commands.

func (*Pipeline)Do

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

Do queues the custom command for later execution.

func (Pipeline)Dump

func (c Pipeline) Dump(ctxcontext.Context, keystring) *StringCmd

func (Pipeline)Echo

func (c Pipeline) Echo(ctxcontext.Context, message interface{}) *StringCmd

func (Pipeline)Eval

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

func (Pipeline)EvalSha

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

func (*Pipeline)Exec

func (c *Pipeline) Exec(ctxcontext.Context) ([]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)Exists

func (c Pipeline) Exists(ctxcontext.Context, keys ...string) *IntCmd

func (Pipeline)Expire

func (c Pipeline) Expire(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Pipeline)ExpireAt

func (c Pipeline) ExpireAt(ctxcontext.Context, keystring, tmtime.Time) *BoolCmd

func (Pipeline)ExpireGTadded inv8.11.5

func (c Pipeline) ExpireGT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Pipeline)ExpireLTadded inv8.11.5

func (c Pipeline) ExpireLT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Pipeline)ExpireNXadded inv8.11.5

func (c Pipeline) ExpireNX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Pipeline)ExpireXXadded inv8.11.5

func (c Pipeline) ExpireXX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Pipeline)FlushAll

func (c Pipeline) FlushAll(ctxcontext.Context) *StatusCmd

func (Pipeline)FlushAllAsync

func (c Pipeline) FlushAllAsync(ctxcontext.Context) *StatusCmd

func (Pipeline)FlushDB

func (c Pipeline) FlushDB(ctxcontext.Context) *StatusCmd

func (Pipeline)FlushDBAsync

func (c Pipeline) FlushDBAsync(ctxcontext.Context) *StatusCmd

func (Pipeline)GeoAdd

func (c Pipeline) GeoAdd(ctxcontext.Context, keystring, geoLocation ...*GeoLocation) *IntCmd

func (Pipeline)GeoDist

func (c Pipeline) GeoDist(ctxcontext.Context, keystring, member1, member2, unitstring,) *FloatCmd

func (Pipeline)GeoHash

func (c Pipeline) GeoHash(ctxcontext.Context, keystring, members ...string) *StringSliceCmd

func (Pipeline)GeoPos

func (c Pipeline) GeoPos(ctxcontext.Context, keystring, members ...string) *GeoPosCmd

func (Pipeline)GeoRadius

func (c Pipeline) GeoRadius(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery,) *GeoLocationCmd

GeoRadius is a read-only GEORADIUS_RO command.

func (Pipeline)GeoRadiusByMember

func (c Pipeline) GeoRadiusByMember(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery,) *GeoLocationCmd

GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.

func (Pipeline)GeoRadiusByMemberStore

func (c Pipeline) GeoRadiusByMemberStore(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery,) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (Pipeline)GeoRadiusStore

func (c Pipeline) GeoRadiusStore(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery,) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (Pipeline)GeoSearchadded inv8.11.1

func (c Pipeline) GeoSearch(ctxcontext.Context, keystring, q *GeoSearchQuery) *StringSliceCmd

func (Pipeline)GeoSearchLocationadded inv8.11.1

func (c Pipeline) GeoSearchLocation(ctxcontext.Context, keystring, q *GeoSearchLocationQuery,) *GeoSearchLocationCmd

func (Pipeline)GeoSearchStoreadded inv8.11.1

func (c Pipeline) GeoSearchStore(ctxcontext.Context, key, storestring, q *GeoSearchStoreQuery) *IntCmd

func (Pipeline)Get

func (c Pipeline) Get(ctxcontext.Context, keystring) *StringCmd

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

func (Pipeline)GetBit

func (c Pipeline) GetBit(ctxcontext.Context, keystring, offsetint64) *IntCmd

func (Pipeline)GetDeladded inv8.8.1

func (c Pipeline) GetDel(ctxcontext.Context, keystring) *StringCmd

GetDel redis-server version >= 6.2.0.

func (Pipeline)GetExadded inv8.8.1

func (c Pipeline) GetEx(ctxcontext.Context, keystring, expirationtime.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist).Requires Redis >= 6.2.0.

func (Pipeline)GetRange

func (c Pipeline) GetRange(ctxcontext.Context, keystring, start, endint64) *StringCmd

func (Pipeline)GetSet

func (c Pipeline) GetSet(ctxcontext.Context, keystring, value interface{}) *StringCmd

func (Pipeline)HDel

func (c Pipeline) HDel(ctxcontext.Context, keystring, fields ...string) *IntCmd

func (Pipeline)HExists

func (c Pipeline) HExists(ctxcontext.Context, key, fieldstring) *BoolCmd

func (Pipeline)HGet

func (c Pipeline) HGet(ctxcontext.Context, key, fieldstring) *StringCmd

func (Pipeline)HGetAll

func (c Pipeline) HGetAll(ctxcontext.Context, keystring) *StringStringMapCmd

func (Pipeline)HIncrBy

func (c Pipeline) HIncrBy(ctxcontext.Context, key, fieldstring, incrint64) *IntCmd

func (Pipeline)HIncrByFloat

func (c Pipeline) HIncrByFloat(ctxcontext.Context, key, fieldstring, incrfloat64) *FloatCmd

func (Pipeline)HKeys

func (c Pipeline) HKeys(ctxcontext.Context, keystring) *StringSliceCmd

func (Pipeline)HLen

func (c Pipeline) HLen(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)HMGet

func (c Pipeline) HMGet(ctxcontext.Context, keystring, fields ...string) *SliceCmd

HMGet returns the values for the specified fields in the hash stored at key.It returns an interface{} to distinguish between empty string and nil value.

func (Pipeline)HMSet

func (c Pipeline) HMSet(ctxcontext.Context, keystring, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (Pipeline)HRandFieldadded inv8.8.1

func (c Pipeline) HRandField(ctxcontext.Context, keystring, countint, withValuesbool) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (Pipeline)HScan

func (c Pipeline) HScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (Pipeline)HSet

func (c Pipeline) HSet(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet("myhash", "key1", "value1", "key2", "value2")
  • HSet("myhash", []string{"key1", "value1", "key2", "value2"})
  • HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

Note that it requires Redis v4 for multiple field/value pairs support.

func (Pipeline)HSetNX

func (c Pipeline) HSetNX(ctxcontext.Context, key, fieldstring, value interface{}) *BoolCmd

func (Pipeline)HVals

func (c Pipeline) HVals(ctxcontext.Context, keystring) *StringSliceCmd

func (Pipeline)Incr

func (c Pipeline) Incr(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)IncrBy

func (c Pipeline) IncrBy(ctxcontext.Context, keystring, valueint64) *IntCmd

func (Pipeline)IncrByFloat

func (c Pipeline) IncrByFloat(ctxcontext.Context, keystring, valuefloat64) *FloatCmd

func (Pipeline)Info

func (c Pipeline) Info(ctxcontext.Context, section ...string) *StringCmd

func (Pipeline)Keys

func (c Pipeline) Keys(ctxcontext.Context, patternstring) *StringSliceCmd

func (Pipeline)LIndex

func (c Pipeline) LIndex(ctxcontext.Context, keystring, indexint64) *StringCmd

func (Pipeline)LInsert

func (c Pipeline) LInsert(ctxcontext.Context, key, opstring, pivot, value interface{}) *IntCmd

func (Pipeline)LInsertAfter

func (c Pipeline) LInsertAfter(ctxcontext.Context, keystring, pivot, value interface{}) *IntCmd

func (Pipeline)LInsertBefore

func (c Pipeline) LInsertBefore(ctxcontext.Context, keystring, pivot, value interface{}) *IntCmd

func (Pipeline)LLen

func (c Pipeline) LLen(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)LMoveadded inv8.8.1

func (c Pipeline) LMove(ctxcontext.Context, source, destination, srcpos, destposstring) *StringCmd

func (Pipeline)LPop

func (c Pipeline) LPop(ctxcontext.Context, keystring) *StringCmd

func (Pipeline)LPopCountadded inv8.8.3

func (c Pipeline) LPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Pipeline)LPosadded inv8.3.4

func (c Pipeline) LPos(ctxcontext.Context, keystring, valuestring, aLPosArgs) *IntCmd

func (Pipeline)LPosCountadded inv8.3.4

func (c Pipeline) LPosCount(ctxcontext.Context, keystring, valuestring, countint64, aLPosArgs) *IntSliceCmd

func (Pipeline)LPush

func (c Pipeline) LPush(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Pipeline)LPushX

func (c Pipeline) LPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Pipeline)LRange

func (c Pipeline) LRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Pipeline)LRem

func (c Pipeline) LRem(ctxcontext.Context, keystring, countint64, value interface{}) *IntCmd

func (Pipeline)LSet

func (c Pipeline) LSet(ctxcontext.Context, keystring, indexint64, value interface{}) *StatusCmd

func (Pipeline)LTrim

func (c Pipeline) LTrim(ctxcontext.Context, keystring, start, stopint64) *StatusCmd

func (Pipeline)LastSave

func (c Pipeline) LastSave(ctxcontext.Context) *IntCmd

func (*Pipeline)Lenadded inv8.11.5

func (c *Pipeline) Len()int

Len returns the number of queued commands.

func (Pipeline)MGet

func (c Pipeline) MGet(ctxcontext.Context, keys ...string) *SliceCmd

func (Pipeline)MSet

func (c Pipeline) MSet(ctxcontext.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Pipeline)MSetNX

func (c Pipeline) MSetNX(ctxcontext.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Pipeline)MemoryUsage

func (c Pipeline) MemoryUsage(ctxcontext.Context, keystring, samples ...int) *IntCmd

func (Pipeline)Migrate

func (c Pipeline) Migrate(ctxcontext.Context, host, port, keystring, dbint, timeouttime.Duration) *StatusCmd

func (Pipeline)Move

func (c Pipeline) Move(ctxcontext.Context, keystring, dbint) *BoolCmd

func (Pipeline)ObjectEncoding

func (c Pipeline) ObjectEncoding(ctxcontext.Context, keystring) *StringCmd

func (Pipeline)ObjectIdleTime

func (c Pipeline) ObjectIdleTime(ctxcontext.Context, keystring) *DurationCmd

func (Pipeline)ObjectRefCount

func (c Pipeline) ObjectRefCount(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)PExpire

func (c Pipeline) PExpire(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Pipeline)PExpireAt

func (c Pipeline) PExpireAt(ctxcontext.Context, keystring, tmtime.Time) *BoolCmd

func (Pipeline)PFAdd

func (c Pipeline) PFAdd(ctxcontext.Context, keystring, els ...interface{}) *IntCmd

func (Pipeline)PFCount

func (c Pipeline) PFCount(ctxcontext.Context, keys ...string) *IntCmd

func (Pipeline)PFMerge

func (c Pipeline) PFMerge(ctxcontext.Context, deststring, keys ...string) *StatusCmd

func (Pipeline)PTTL

func (c Pipeline) PTTL(ctxcontext.Context, keystring) *DurationCmd

func (Pipeline)Persist

func (c Pipeline) Persist(ctxcontext.Context, keystring) *BoolCmd

func (Pipeline)Ping

func (c Pipeline) Ping(ctxcontext.Context) *StatusCmd

func (*Pipeline)Pipeline

func (c *Pipeline) Pipeline()Pipeliner

func (*Pipeline)Pipelined

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

func (*Pipeline)Process

func (c *Pipeline) Process(ctxcontext.Context, cmdCmder)error

Process queues the cmd for later execution.

func (Pipeline)PubSubChannels

func (c Pipeline) PubSubChannels(ctxcontext.Context, patternstring) *StringSliceCmd

func (Pipeline)PubSubNumPat

func (c Pipeline) PubSubNumPat(ctxcontext.Context) *IntCmd

func (Pipeline)PubSubNumSub

func (c Pipeline) PubSubNumSub(ctxcontext.Context, channels ...string) *StringIntMapCmd

func (Pipeline)Publish

func (c Pipeline) Publish(ctxcontext.Context, channelstring, message interface{}) *IntCmd

Publish posts the message to the channel.

func (Pipeline)Quit

func (c Pipeline) Quit(_context.Context) *StatusCmd

func (Pipeline)RPop

func (c Pipeline) RPop(ctxcontext.Context, keystring) *StringCmd

func (Pipeline)RPopCountadded inv8.11.1

func (c Pipeline) RPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Pipeline)RPopLPush

func (c Pipeline) RPopLPush(ctxcontext.Context, source, destinationstring) *StringCmd

func (Pipeline)RPush

func (c Pipeline) RPush(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Pipeline)RPushX

func (c Pipeline) RPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Pipeline)RandomKey

func (c Pipeline) RandomKey(ctxcontext.Context) *StringCmd

func (Pipeline)ReadOnly

func (c Pipeline) ReadOnly(ctxcontext.Context) *StatusCmd

func (Pipeline)ReadWrite

func (c Pipeline) ReadWrite(ctxcontext.Context) *StatusCmd

func (Pipeline)Rename

func (c Pipeline) Rename(ctxcontext.Context, key, newkeystring) *StatusCmd

func (Pipeline)RenameNX

func (c Pipeline) RenameNX(ctxcontext.Context, key, newkeystring) *BoolCmd

func (Pipeline)Restore

func (c Pipeline) Restore(ctxcontext.Context, keystring, ttltime.Duration, valuestring) *StatusCmd

func (Pipeline)RestoreReplace

func (c Pipeline) RestoreReplace(ctxcontext.Context, keystring, ttltime.Duration, valuestring) *StatusCmd

func (Pipeline)SAdd

func (c Pipeline) SAdd(ctxcontext.Context, keystring, members ...interface{}) *IntCmd

func (Pipeline)SCard

func (c Pipeline) SCard(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)SDiff

func (c Pipeline) SDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Pipeline)SDiffStore

func (c Pipeline) SDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

func (Pipeline)SInter

func (c Pipeline) SInter(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Pipeline)SInterStore

func (c Pipeline) SInterStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

func (Pipeline)SIsMember

func (c Pipeline) SIsMember(ctxcontext.Context, keystring, member interface{}) *BoolCmd

func (Pipeline)SMIsMemberadded inv8.8.3

func (c Pipeline) SMIsMember(ctxcontext.Context, keystring, members ...interface{}) *BoolSliceCmd

SMIsMember Redis `SMISMEMBER key member [member ...]` command.

func (Pipeline)SMembers

func (c Pipeline) SMembers(ctxcontext.Context, keystring) *StringSliceCmd

SMembers Redis `SMEMBERS key` command output as a slice.

func (Pipeline)SMembersMap

func (c Pipeline) SMembersMap(ctxcontext.Context, keystring) *StringStructMapCmd

SMembersMap Redis `SMEMBERS key` command output as a map.

func (Pipeline)SMove

func (c Pipeline) SMove(ctxcontext.Context, source, destinationstring, member interface{}) *BoolCmd

func (Pipeline)SPop

func (c Pipeline) SPop(ctxcontext.Context, keystring) *StringCmd

SPop Redis `SPOP key` command.

func (Pipeline)SPopN

func (c Pipeline) SPopN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SPopN Redis `SPOP key count` command.

func (Pipeline)SRandMember

func (c Pipeline) SRandMember(ctxcontext.Context, keystring) *StringCmd

SRandMember Redis `SRANDMEMBER key` command.

func (Pipeline)SRandMemberN

func (c Pipeline) SRandMemberN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SRandMemberN Redis `SRANDMEMBER key count` command.

func (Pipeline)SRem

func (c Pipeline) SRem(ctxcontext.Context, keystring, members ...interface{}) *IntCmd

func (Pipeline)SScan

func (c Pipeline) SScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (Pipeline)SUnion

func (c Pipeline) SUnion(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Pipeline)SUnionStore

func (c Pipeline) SUnionStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

func (Pipeline)Save

func (c Pipeline) Save(ctxcontext.Context) *StatusCmd

func (Pipeline)Scan

func (c Pipeline) Scan(ctxcontext.Context, cursoruint64, matchstring, countint64) *ScanCmd

func (Pipeline)ScanTypeadded inv8.4.7

func (c Pipeline) ScanType(ctxcontext.Context, cursoruint64, matchstring, countint64, keyTypestring) *ScanCmd

func (Pipeline)ScriptExists

func (c Pipeline) ScriptExists(ctxcontext.Context, hashes ...string) *BoolSliceCmd

func (Pipeline)ScriptFlush

func (c Pipeline) ScriptFlush(ctxcontext.Context) *StatusCmd

func (Pipeline)ScriptKill

func (c Pipeline) ScriptKill(ctxcontext.Context) *StatusCmd

func (Pipeline)ScriptLoad

func (c Pipeline) ScriptLoad(ctxcontext.Context, scriptstring) *StringCmd

func (Pipeline)Select

func (c Pipeline) Select(ctxcontext.Context, indexint) *StatusCmd

func (Pipeline)Set

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

Set Redis `SET key value [expiration]` command.Use expiration for `SETEX`-like behavior.

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Pipeline)SetArgsadded inv8.6.0

func (c Pipeline) SetArgs(ctxcontext.Context, keystring, value interface{}, aSetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports.It is the alternative to the Set function when you wantto have more control over the options.

func (Pipeline)SetBit

func (c Pipeline) SetBit(ctxcontext.Context, keystring, offsetint64, valueint) *IntCmd

func (Pipeline)SetEXadded inv8.3.3

func (c Pipeline) SetEX(ctxcontext.Context, keystring, value interface{}, expirationtime.Duration) *StatusCmd

SetEX Redis `SETEX key expiration value` command.

func (Pipeline)SetNX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Pipeline)SetRange

func (c Pipeline) SetRange(ctxcontext.Context, keystring, offsetint64, valuestring) *IntCmd

func (Pipeline)SetXX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Pipeline)Shutdown

func (c Pipeline) Shutdown(ctxcontext.Context) *StatusCmd

func (Pipeline)ShutdownNoSave

func (c Pipeline) ShutdownNoSave(ctxcontext.Context) *StatusCmd

func (Pipeline)ShutdownSave

func (c Pipeline) ShutdownSave(ctxcontext.Context) *StatusCmd

func (Pipeline)SlaveOf

func (c Pipeline) SlaveOf(ctxcontext.Context, host, portstring) *StatusCmd

func (Pipeline)SlowLogGet

func (c Pipeline) SlowLogGet(ctxcontext.Context, numint64) *SlowLogCmd

func (Pipeline)Sort

func (c Pipeline) Sort(ctxcontext.Context, keystring, sort *Sort) *StringSliceCmd

func (Pipeline)SortInterfaces

func (c Pipeline) SortInterfaces(ctxcontext.Context, keystring, sort *Sort) *SliceCmd

func (Pipeline)SortStore

func (c Pipeline) SortStore(ctxcontext.Context, key, storestring, sort *Sort) *IntCmd

func (Pipeline)StrLen

func (c Pipeline) StrLen(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)SwapDB

func (c Pipeline) SwapDB(ctxcontext.Context, index1, index2int) *StatusCmd

func (Pipeline)Sync

func (c Pipeline) Sync(_context.Context)

func (Pipeline)TTL

func (c Pipeline) TTL(ctxcontext.Context, keystring) *DurationCmd

func (Pipeline)Time

func (c Pipeline) Time(ctxcontext.Context) *TimeCmd

func (Pipeline)Touch

func (c Pipeline) Touch(ctxcontext.Context, keys ...string) *IntCmd

func (*Pipeline)TxPipeline

func (c *Pipeline) TxPipeline()Pipeliner

func (*Pipeline)TxPipelined

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

func (Pipeline)Type

func (c Pipeline) Type(ctxcontext.Context, keystring) *StatusCmd

func (Pipeline)Unlink

func (c Pipeline) Unlink(ctxcontext.Context, keys ...string) *IntCmd

func (Pipeline)Wait

func (c Pipeline) Wait(ctxcontext.Context, numSlavesint, timeouttime.Duration) *IntCmd

func (Pipeline)XAck

func (c Pipeline) XAck(ctxcontext.Context, stream, groupstring, ids ...string) *IntCmd

func (Pipeline)XAdd

func (c Pipeline) XAdd(ctxcontext.Context, a *XAddArgs) *StringCmd

XAdd a.Limit has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046

func (Pipeline)XAutoClaimadded inv8.11.0

func (c Pipeline) XAutoClaim(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimCmd

func (Pipeline)XAutoClaimJustIDadded inv8.11.0

func (c Pipeline) XAutoClaimJustID(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd

func (Pipeline)XClaim

func (c Pipeline) XClaim(ctxcontext.Context, a *XClaimArgs) *XMessageSliceCmd

func (Pipeline)XClaimJustID

func (c Pipeline) XClaimJustID(ctxcontext.Context, a *XClaimArgs) *StringSliceCmd

func (Pipeline)XDel

func (c Pipeline) XDel(ctxcontext.Context, streamstring, ids ...string) *IntCmd

func (Pipeline)XGroupCreate

func (c Pipeline) XGroupCreate(ctxcontext.Context, stream, group, startstring) *StatusCmd

func (Pipeline)XGroupCreateConsumeradded inv8.11.0

func (c Pipeline) XGroupCreateConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmd

func (Pipeline)XGroupCreateMkStream

func (c Pipeline) XGroupCreateMkStream(ctxcontext.Context, stream, group, startstring) *StatusCmd

func (Pipeline)XGroupDelConsumer

func (c Pipeline) XGroupDelConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmd

func (Pipeline)XGroupDestroy

func (c Pipeline) XGroupDestroy(ctxcontext.Context, stream, groupstring) *IntCmd

func (Pipeline)XGroupSetID

func (c Pipeline) XGroupSetID(ctxcontext.Context, stream, group, startstring) *StatusCmd

func (Pipeline)XInfoConsumersadded inv8.6.0

func (c Pipeline) XInfoConsumers(ctxcontext.Context, keystring, groupstring) *XInfoConsumersCmd

func (Pipeline)XInfoGroups

func (c Pipeline) XInfoGroups(ctxcontext.Context, keystring) *XInfoGroupsCmd

func (Pipeline)XInfoStreamadded inv8.2.1

func (c Pipeline) XInfoStream(ctxcontext.Context, keystring) *XInfoStreamCmd

func (Pipeline)XInfoStreamFulladded inv8.9.0

func (c Pipeline) XInfoStreamFull(ctxcontext.Context, keystring, countint) *XInfoStreamFullCmd

XInfoStreamFull XINFO STREAM FULL [COUNT count]redis-server >= 6.0.

func (Pipeline)XLen

func (c Pipeline) XLen(ctxcontext.Context, streamstring) *IntCmd

func (Pipeline)XPending

func (c Pipeline) XPending(ctxcontext.Context, stream, groupstring) *XPendingCmd

func (Pipeline)XPendingExt

func (c Pipeline) XPendingExt(ctxcontext.Context, a *XPendingExtArgs) *XPendingExtCmd

func (Pipeline)XRange

func (c Pipeline) XRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmd

func (Pipeline)XRangeN

func (c Pipeline) XRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmd

func (Pipeline)XRead

func (c Pipeline) XRead(ctxcontext.Context, a *XReadArgs) *XStreamSliceCmd

func (Pipeline)XReadGroup

func (c Pipeline) XReadGroup(ctxcontext.Context, a *XReadGroupArgs) *XStreamSliceCmd

func (Pipeline)XReadStreams

func (c Pipeline) XReadStreams(ctxcontext.Context, streams ...string) *XStreamSliceCmd

func (Pipeline)XRevRange

func (c Pipeline) XRevRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmd

func (Pipeline)XRevRangeN

func (c Pipeline) XRevRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmd

func (Pipeline)XTrimdeprecated

func (c Pipeline) XTrim(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLen, remove in v9.

func (Pipeline)XTrimApproxdeprecated

func (c Pipeline) XTrimApprox(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLenApprox, remove in v9.

func (Pipeline)XTrimMaxLenadded inv8.11.0

func (c Pipeline) XTrimMaxLen(ctxcontext.Context, keystring, maxLenint64) *IntCmd

XTrimMaxLen No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MAXLEN maxLen

func (Pipeline)XTrimMaxLenApproxadded inv8.11.0

func (c Pipeline) XTrimMaxLenApprox(ctxcontext.Context, keystring, maxLen, limitint64) *IntCmd

XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit

func (Pipeline)XTrimMinIDadded inv8.11.0

func (c Pipeline) XTrimMinID(ctxcontext.Context, keystring, minIDstring) *IntCmd

XTrimMinID No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MINID minID

func (Pipeline)XTrimMinIDApproxadded inv8.11.0

func (c Pipeline) XTrimMinIDApprox(ctxcontext.Context, keystring, minIDstring, limitint64) *IntCmd

XTrimMinIDApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MINID ~ minID LIMIT limit

func (Pipeline)ZAdd

func (c Pipeline) ZAdd(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Pipeline)ZAddArgsadded inv8.11.0

func (c Pipeline) ZAddArgs(ctxcontext.Context, keystring, argsZAddArgs) *IntCmd

func (Pipeline)ZAddArgsIncradded inv8.11.0

func (c Pipeline) ZAddArgsIncr(ctxcontext.Context, keystring, argsZAddArgs) *FloatCmd

func (Pipeline)ZAddCh

func (c Pipeline) ZAddCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddCh Redis `ZADD key CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{Ch: true,Members: []Z,})remove in v9.

func (Pipeline)ZAddNX

func (c Pipeline) ZAddNX(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Pipeline)ZAddNXCh

func (c Pipeline) ZAddNXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{NX: true,Ch: true,Members: []Z,})remove in v9.

func (Pipeline)ZAddXX

func (c Pipeline) ZAddXX(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Pipeline)ZAddXXCh

func (c Pipeline) ZAddXXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{XX: true,Ch: true,Members: []Z,})remove in v9.

func (Pipeline)ZCard

func (c Pipeline) ZCard(ctxcontext.Context, keystring) *IntCmd

func (Pipeline)ZCount

func (c Pipeline) ZCount(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Pipeline)ZDiffadded inv8.9.0

func (c Pipeline) ZDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

ZDiff redis-server version >= 6.2.0.

func (Pipeline)ZDiffStoreadded inv8.10.0

func (c Pipeline) ZDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

ZDiffStore redis-server version >=6.2.0.

func (Pipeline)ZDiffWithScoresadded inv8.9.0

func (c Pipeline) ZDiffWithScores(ctxcontext.Context, keys ...string) *ZSliceCmd

ZDiffWithScores redis-server version >= 6.2.0.

func (Pipeline)ZIncr

func (c Pipeline) ZIncr(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncr Redis `ZADD key INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{Members: []Z,})remove in v9.

func (Pipeline)ZIncrBy

func (c Pipeline) ZIncrBy(ctxcontext.Context, keystring, incrementfloat64, memberstring) *FloatCmd

func (Pipeline)ZIncrNX

func (c Pipeline) ZIncrNX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrNX Redis `ZADD key NX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{NX: true,Members: []Z,})remove in v9.

func (Pipeline)ZIncrXX

func (c Pipeline) ZIncrXX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrXX Redis `ZADD key XX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{XX: true,Members: []Z,})remove in v9.

func (Pipeline)ZInteradded inv8.10.0

func (c Pipeline) ZInter(ctxcontext.Context, store *ZStore) *StringSliceCmd

func (Pipeline)ZInterStore

func (c Pipeline) ZInterStore(ctxcontext.Context, destinationstring, store *ZStore) *IntCmd

func (Pipeline)ZInterWithScoresadded inv8.10.0

func (c Pipeline) ZInterWithScores(ctxcontext.Context, store *ZStore) *ZSliceCmd

func (Pipeline)ZLexCount

func (c Pipeline) ZLexCount(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Pipeline)ZMScoreadded inv8.8.0

func (c Pipeline) ZMScore(ctxcontext.Context, keystring, members ...string) *FloatSliceCmd

func (Pipeline)ZPopMax

func (c Pipeline) ZPopMax(ctxcontext.Context, keystring, count ...int64) *ZSliceCmd

func (Pipeline)ZPopMin

func (c Pipeline) ZPopMin(ctxcontext.Context, keystring, count ...int64) *ZSliceCmd

func (Pipeline)ZRandMemberadded inv8.8.1

func (c Pipeline) ZRandMember(ctxcontext.Context, keystring, countint, withScoresbool) *StringSliceCmd

ZRandMember redis-server version >= 6.2.0.

func (Pipeline)ZRange

func (c Pipeline) ZRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Pipeline)ZRangeArgsadded inv8.11.0

func (c Pipeline) ZRangeArgs(ctxcontext.Context, zZRangeArgs) *StringSliceCmd

func (Pipeline)ZRangeArgsWithScoresadded inv8.11.0

func (c Pipeline) ZRangeArgsWithScores(ctxcontext.Context, zZRangeArgs) *ZSliceCmd

func (Pipeline)ZRangeByLex

func (c Pipeline) ZRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Pipeline)ZRangeByScore

func (c Pipeline) ZRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Pipeline)ZRangeByScoreWithScores

func (c Pipeline) ZRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Pipeline)ZRangeStoreadded inv8.11.0

func (c Pipeline) ZRangeStore(ctxcontext.Context, dststring, zZRangeArgs) *IntCmd

func (Pipeline)ZRangeWithScores

func (c Pipeline) ZRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmd

func (Pipeline)ZRank

func (c Pipeline) ZRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Pipeline)ZRem

func (c Pipeline) ZRem(ctxcontext.Context, keystring, members ...interface{}) *IntCmd

func (Pipeline)ZRemRangeByLex

func (c Pipeline) ZRemRangeByLex(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Pipeline)ZRemRangeByRank

func (c Pipeline) ZRemRangeByRank(ctxcontext.Context, keystring, start, stopint64) *IntCmd

func (Pipeline)ZRemRangeByScore

func (c Pipeline) ZRemRangeByScore(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Pipeline)ZRevRange

func (c Pipeline) ZRevRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Pipeline)ZRevRangeByLex

func (c Pipeline) ZRevRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Pipeline)ZRevRangeByScore

func (c Pipeline) ZRevRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Pipeline)ZRevRangeByScoreWithScores

func (c Pipeline) ZRevRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Pipeline)ZRevRangeWithScores

func (c Pipeline) ZRevRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmd

func (Pipeline)ZRevRank

func (c Pipeline) ZRevRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Pipeline)ZScan

func (c Pipeline) ZScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (Pipeline)ZScore

func (c Pipeline) ZScore(ctxcontext.Context, key, memberstring) *FloatCmd

func (Pipeline)ZUnionadded inv8.11.0

func (c Pipeline) ZUnion(ctxcontext.Context, storeZStore) *StringSliceCmd

func (Pipeline)ZUnionStore

func (c Pipeline) ZUnionStore(ctxcontext.Context, deststring, store *ZStore) *IntCmd

func (Pipeline)ZUnionWithScoresadded inv8.11.0

func (c Pipeline) ZUnionWithScores(ctxcontext.Context, storeZStore) *ZSliceCmd

typePipeliner

type Pipeliner interface {StatefulCmdableLen()intDo(ctxcontext.Context, args ...interface{}) *CmdProcess(ctxcontext.Context, cmdCmder)errorClose()errorDiscard()errorExec(ctxcontext.Context) ([]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
pubsub := rdb.Subscribe(ctx, "mychannel1")// Wait for confirmation that subscription is created before publishing anything._, err := pubsub.Receive(ctx)if err != nil {panic(err)}// Go channel which receives messages.ch := pubsub.Channel()// Publish a message.err = rdb.Publish(ctx, "mychannel1", "hello").Err()if err != nil {panic(err)}time.AfterFunc(time.Second, func() {// When pubsub is closed channel is closed too._ = pubsub.Close()})// Consume messages.for msg := range ch {fmt.Println(msg.Channel, msg.Payload)}
Output:mychannel1 hello

func (*PubSub)Channel

func (c *PubSub) Channel(opts ...ChannelOption) <-chan *Message

Channel returns a Go channel for concurrently receiving messages.The channel is closed together with the PubSub. If the Go channelis blocked full for 30 seconds the message is dropped.Receive* APIs can not be used after channel is created.

go-redis periodically sends ping messages to test connection healthand re-subscribes if ping can not not received for 30 seconds.

func (*PubSub)ChannelSizedeprecated

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

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

Deprecated: use Channel(WithChannelSize(size)), remove in v9.

func (*PubSub)ChannelWithSubscriptions

func (c *PubSub) ChannelWithSubscriptions(_context.Context, sizeint) <-chan interface{}

ChannelWithSubscriptions is like Channel, but message type can be either*Subscription or *Message. Subscription messages can be used to detectreconnections.

ChannelWithSubscriptions can not be used together with Channel or ChannelSize.

func (*PubSub)Close

func (c *PubSub) Close()error

func (*PubSub)PSubscribe

func (c *PubSub) PSubscribe(ctxcontext.Context, 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(ctxcontext.Context, 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(ctxcontext.Context, payload ...string)error

func (*PubSub)Receive

func (c *PubSub) Receive(ctxcontext.Context) (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
pubsub := rdb.Subscribe(ctx, "mychannel2")defer pubsub.Close()for i := 0; i < 2; i++ {// ReceiveTimeout is a low level API. Use ReceiveMessage instead.msgi, err := pubsub.ReceiveTimeout(ctx, time.Second)if err != nil {break}switch msg := msgi.(type) {case *redis.Subscription:fmt.Println("subscribed to", msg.Channel)_, err := rdb.Publish(ctx, "mychannel2", "hello").Result()if err != nil {panic(err)}case *redis.Message:fmt.Println("received", msg.Payload, "from", msg.Channel)default:panic("unreached")}}// sent message to 1 rdb// received hello from mychannel2

func (*PubSub)ReceiveMessage

func (c *PubSub) ReceiveMessage(ctxcontext.Context) (*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(ctxcontext.Context, 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(ctxcontext.Context, 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(ctxcontext.Context, 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
rdb := redis.NewRing(&redis.RingOptions{Addrs: map[string]string{"shard1": ":7000","shard2": ":7001","shard3": ":7002",},})rdb.Ping(ctx)

func (*Ring)AddHook

func (hs *Ring) AddHook(hookHook)

func (Ring)Append

func (c Ring) Append(ctxcontext.Context, key, valuestring) *IntCmd

func (Ring)BLMoveadded inv8.11.4

func (c Ring) BLMove(ctxcontext.Context, source, destination, srcpos, destposstring, timeouttime.Duration,) *StringCmd

func (Ring)BLPop

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

func (Ring)BRPop

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

func (Ring)BRPopLPush

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

func (Ring)BZPopMax

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

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

func (Ring)BZPopMin

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

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

func (Ring)BgRewriteAOF

func (c Ring) BgRewriteAOF(ctxcontext.Context) *StatusCmd

func (Ring)BgSave

func (c Ring) BgSave(ctxcontext.Context) *StatusCmd

func (Ring)BitCount

func (c Ring) BitCount(ctxcontext.Context, keystring, bitCount *BitCount) *IntCmd

func (Ring)BitField

func (c Ring) BitField(ctxcontext.Context, keystring, args ...interface{}) *IntSliceCmd

func (Ring)BitOpAnd

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

func (Ring)BitOpNot

func (c Ring) BitOpNot(ctxcontext.Context, destKeystring, keystring) *IntCmd

func (Ring)BitOpOr

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

func (Ring)BitOpXor

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

func (Ring)BitPos

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

func (Ring)ClientGetName

func (c Ring) ClientGetName(ctxcontext.Context) *StringCmd

ClientGetName returns the name of the connection.

func (Ring)ClientID

func (c Ring) ClientID(ctxcontext.Context) *IntCmd

func (Ring)ClientKill

func (c Ring) ClientKill(ctxcontext.Context, ipPortstring) *StatusCmd

func (Ring)ClientKillByFilter

func (c Ring) ClientKillByFilter(ctxcontext.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (Ring)ClientList

func (c Ring) ClientList(ctxcontext.Context) *StringCmd

func (Ring)ClientPause

func (c Ring) ClientPause(ctxcontext.Context, durtime.Duration) *BoolCmd

func (Ring)ClientUnblock

func (c Ring) ClientUnblock(ctxcontext.Context, idint64) *IntCmd

func (Ring)ClientUnblockWithError

func (c Ring) ClientUnblockWithError(ctxcontext.Context, 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(ctxcontext.Context, slots ...int) *StatusCmd

func (Ring)ClusterAddSlotsRange

func (c Ring) ClusterAddSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Ring)ClusterCountFailureReports

func (c Ring) ClusterCountFailureReports(ctxcontext.Context, nodeIDstring) *IntCmd

func (Ring)ClusterCountKeysInSlot

func (c Ring) ClusterCountKeysInSlot(ctxcontext.Context, slotint) *IntCmd

func (Ring)ClusterDelSlots

func (c Ring) ClusterDelSlots(ctxcontext.Context, slots ...int) *StatusCmd

func (Ring)ClusterDelSlotsRange

func (c Ring) ClusterDelSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Ring)ClusterFailover

func (c Ring) ClusterFailover(ctxcontext.Context) *StatusCmd

func (Ring)ClusterForget

func (c Ring) ClusterForget(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Ring)ClusterGetKeysInSlot

func (c Ring) ClusterGetKeysInSlot(ctxcontext.Context, slotint, countint) *StringSliceCmd

func (Ring)ClusterInfo

func (c Ring) ClusterInfo(ctxcontext.Context) *StringCmd

func (Ring)ClusterKeySlot

func (c Ring) ClusterKeySlot(ctxcontext.Context, keystring) *IntCmd

func (Ring)ClusterMeet

func (c Ring) ClusterMeet(ctxcontext.Context, host, portstring) *StatusCmd

func (Ring)ClusterNodes

func (c Ring) ClusterNodes(ctxcontext.Context) *StringCmd

func (Ring)ClusterReplicate

func (c Ring) ClusterReplicate(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Ring)ClusterResetHard

func (c Ring) ClusterResetHard(ctxcontext.Context) *StatusCmd

func (Ring)ClusterResetSoft

func (c Ring) ClusterResetSoft(ctxcontext.Context) *StatusCmd

func (Ring)ClusterSaveConfig

func (c Ring) ClusterSaveConfig(ctxcontext.Context) *StatusCmd

func (Ring)ClusterSlaves

func (c Ring) ClusterSlaves(ctxcontext.Context, nodeIDstring) *StringSliceCmd

func (Ring)ClusterSlots

func (c Ring) ClusterSlots(ctxcontext.Context) *ClusterSlotsCmd

func (Ring)Command

func (c Ring) Command(ctxcontext.Context) *CommandsInfoCmd

func (Ring)ConfigGet

func (c Ring) ConfigGet(ctxcontext.Context, parameterstring) *SliceCmd

func (Ring)ConfigResetStat

func (c Ring) ConfigResetStat(ctxcontext.Context) *StatusCmd

func (Ring)ConfigRewrite

func (c Ring) ConfigRewrite(ctxcontext.Context) *StatusCmd

func (Ring)ConfigSet

func (c Ring) ConfigSet(ctxcontext.Context, parameter, valuestring) *StatusCmd

func (*Ring)Context

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

func (Ring)Copyadded inv8.11.5

func (c Ring) Copy(ctxcontext.Context, sourceKey, destKeystring, dbint, replacebool) *IntCmd

func (Ring)DBSize

func (c Ring) DBSize(ctxcontext.Context) *IntCmd

func (Ring)DebugObject

func (c Ring) DebugObject(ctxcontext.Context, keystring) *StringCmd

func (Ring)Decr

func (c Ring) Decr(ctxcontext.Context, keystring) *IntCmd

func (Ring)DecrBy

func (c Ring) DecrBy(ctxcontext.Context, keystring, decrementint64) *IntCmd

func (Ring)Del

func (c Ring) Del(ctxcontext.Context, keys ...string) *IntCmd

func (*Ring)Do

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

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

func (Ring)Dump

func (c Ring) Dump(ctxcontext.Context, keystring) *StringCmd

func (Ring)Echo

func (c Ring) Echo(ctxcontext.Context, message interface{}) *StringCmd

func (Ring)Eval

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

func (Ring)EvalSha

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

func (Ring)Exists

func (c Ring) Exists(ctxcontext.Context, keys ...string) *IntCmd

func (Ring)Expire

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

func (Ring)ExpireAt

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

func (Ring)ExpireGTadded inv8.11.5

func (c Ring) ExpireGT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Ring)ExpireLTadded inv8.11.5

func (c Ring) ExpireLT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Ring)ExpireNXadded inv8.11.5

func (c Ring) ExpireNX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Ring)ExpireXXadded inv8.11.5

func (c Ring) ExpireXX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Ring)FlushAll

func (c Ring) FlushAll(ctxcontext.Context) *StatusCmd

func (Ring)FlushAllAsync

func (c Ring) FlushAllAsync(ctxcontext.Context) *StatusCmd

func (Ring)FlushDB

func (c Ring) FlushDB(ctxcontext.Context) *StatusCmd

func (Ring)FlushDBAsync

func (c Ring) FlushDBAsync(ctxcontext.Context) *StatusCmd

func (*Ring)ForEachShard

func (c *Ring) ForEachShard(ctxcontext.Context,fn func(ctxcontext.Context, client *Client)error,)error

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

func (Ring)GeoAdd

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

func (Ring)GeoDist

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

func (Ring)GeoHash

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

func (Ring)GeoPos

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

func (Ring)GeoRadius

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

GeoRadius is a read-only GEORADIUS_RO command.

func (Ring)GeoRadiusByMember

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

GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.

func (Ring)GeoRadiusByMemberStore

func (c Ring) GeoRadiusByMemberStore(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery,) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (Ring)GeoRadiusStore

func (c Ring) GeoRadiusStore(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery,) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (Ring)GeoSearchadded inv8.11.1

func (c Ring) GeoSearch(ctxcontext.Context, keystring, q *GeoSearchQuery) *StringSliceCmd

func (Ring)GeoSearchLocationadded inv8.11.1

func (c Ring) GeoSearchLocation(ctxcontext.Context, keystring, q *GeoSearchLocationQuery,) *GeoSearchLocationCmd

func (Ring)GeoSearchStoreadded inv8.11.1

func (c Ring) GeoSearchStore(ctxcontext.Context, key, storestring, q *GeoSearchStoreQuery) *IntCmd

func (Ring)Get

func (c Ring) Get(ctxcontext.Context, keystring) *StringCmd

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

func (Ring)GetBit

func (c Ring) GetBit(ctxcontext.Context, keystring, offsetint64) *IntCmd

func (Ring)GetDeladded inv8.8.1

func (c Ring) GetDel(ctxcontext.Context, keystring) *StringCmd

GetDel redis-server version >= 6.2.0.

func (Ring)GetExadded inv8.8.1

func (c Ring) GetEx(ctxcontext.Context, keystring, expirationtime.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist).Requires Redis >= 6.2.0.

func (Ring)GetRange

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

func (Ring)GetSet

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

func (Ring)HDel

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

func (Ring)HExists

func (c Ring) HExists(ctxcontext.Context, key, fieldstring) *BoolCmd

func (Ring)HGet

func (c Ring) HGet(ctxcontext.Context, key, fieldstring) *StringCmd

func (Ring)HGetAll

func (c Ring) HGetAll(ctxcontext.Context, keystring) *StringStringMapCmd

func (Ring)HIncrBy

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

func (Ring)HIncrByFloat

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

func (Ring)HKeys

func (c Ring) HKeys(ctxcontext.Context, keystring) *StringSliceCmd

func (Ring)HLen

func (c Ring) HLen(ctxcontext.Context, keystring) *IntCmd

func (Ring)HMGet

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

HMGet returns the values for the specified fields in the hash stored at key.It returns an interface{} to distinguish between empty string and nil value.

func (Ring)HMSet

func (c Ring) HMSet(ctxcontext.Context, keystring, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (Ring)HRandFieldadded inv8.8.1

func (c Ring) HRandField(ctxcontext.Context, keystring, countint, withValuesbool) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (Ring)HScan

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

func (Ring)HSet

func (c Ring) HSet(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet("myhash", "key1", "value1", "key2", "value2")
  • HSet("myhash", []string{"key1", "value1", "key2", "value2"})
  • HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

Note that it requires Redis v4 for multiple field/value pairs support.

func (Ring)HSetNX

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

func (Ring)HVals

func (c Ring) HVals(ctxcontext.Context, keystring) *StringSliceCmd

func (Ring)Incr

func (c Ring) Incr(ctxcontext.Context, keystring) *IntCmd

func (Ring)IncrBy

func (c Ring) IncrBy(ctxcontext.Context, keystring, valueint64) *IntCmd

func (Ring)IncrByFloat

func (c Ring) IncrByFloat(ctxcontext.Context, keystring, valuefloat64) *FloatCmd

func (Ring)Info

func (c Ring) Info(ctxcontext.Context, section ...string) *StringCmd

func (Ring)Keys

func (c Ring) Keys(ctxcontext.Context, patternstring) *StringSliceCmd

func (Ring)LIndex

func (c Ring) LIndex(ctxcontext.Context, keystring, indexint64) *StringCmd

func (Ring)LInsert

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

func (Ring)LInsertAfter

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

func (Ring)LInsertBefore

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

func (Ring)LLen

func (c Ring) LLen(ctxcontext.Context, keystring) *IntCmd

func (Ring)LMoveadded inv8.8.1

func (c Ring) LMove(ctxcontext.Context, source, destination, srcpos, destposstring) *StringCmd

func (Ring)LPop

func (c Ring) LPop(ctxcontext.Context, keystring) *StringCmd

func (Ring)LPopCountadded inv8.8.3

func (c Ring) LPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Ring)LPosadded inv8.3.4

func (c Ring) LPos(ctxcontext.Context, keystring, valuestring, aLPosArgs) *IntCmd

func (Ring)LPosCountadded inv8.3.4

func (c Ring) LPosCount(ctxcontext.Context, keystring, valuestring, countint64, aLPosArgs) *IntSliceCmd

func (Ring)LPush

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

func (Ring)LPushX

func (c Ring) LPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Ring)LRange

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

func (Ring)LRem

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

func (Ring)LSet

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

func (Ring)LTrim

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

func (Ring)LastSave

func (c Ring) LastSave(ctxcontext.Context) *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(ctxcontext.Context, keys ...string) *SliceCmd

func (Ring)MSet

func (c Ring) MSet(ctxcontext.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Ring)MSetNX

func (c Ring) MSetNX(ctxcontext.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Ring)MemoryUsage

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

func (Ring)Migrate

func (c Ring) Migrate(ctxcontext.Context, host, port, keystring, dbint, timeouttime.Duration) *StatusCmd

func (Ring)Move

func (c Ring) Move(ctxcontext.Context, keystring, dbint) *BoolCmd

func (Ring)ObjectEncoding

func (c Ring) ObjectEncoding(ctxcontext.Context, keystring) *StringCmd

func (Ring)ObjectIdleTime

func (c Ring) ObjectIdleTime(ctxcontext.Context, keystring) *DurationCmd

func (Ring)ObjectRefCount

func (c Ring) ObjectRefCount(ctxcontext.Context, 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(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Ring)PExpireAt

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

func (Ring)PFAdd

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

func (Ring)PFCount

func (c Ring) PFCount(ctxcontext.Context, keys ...string) *IntCmd

func (Ring)PFMerge

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

func (*Ring)PSubscribe

func (c *Ring) PSubscribe(ctxcontext.Context, channels ...string) *PubSub

PSubscribe subscribes the client to the given patterns.

func (Ring)PTTL

func (c Ring) PTTL(ctxcontext.Context, keystring) *DurationCmd

func (Ring)Persist

func (c Ring) Persist(ctxcontext.Context, keystring) *BoolCmd

func (Ring)Ping

func (c Ring) Ping(ctxcontext.Context) *StatusCmd

func (*Ring)Pipeline

func (c *Ring) Pipeline()Pipeliner

func (*Ring)Pipelined

func (c *Ring) Pipelined(ctxcontext.Context, 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(ctxcontext.Context, cmdCmder)error

func (Ring)PubSubChannels

func (c Ring) PubSubChannels(ctxcontext.Context, patternstring) *StringSliceCmd

func (Ring)PubSubNumPat

func (c Ring) PubSubNumPat(ctxcontext.Context) *IntCmd

func (Ring)PubSubNumSub

func (c Ring) PubSubNumSub(ctxcontext.Context, channels ...string) *StringIntMapCmd

func (Ring)Publish

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

Publish posts the message to the channel.

func (Ring)Quit

func (c Ring) Quit(_context.Context) *StatusCmd

func (Ring)RPop

func (c Ring) RPop(ctxcontext.Context, keystring) *StringCmd

func (Ring)RPopCountadded inv8.11.1

func (c Ring) RPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Ring)RPopLPush

func (c Ring) RPopLPush(ctxcontext.Context, source, destinationstring) *StringCmd

func (Ring)RPush

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

func (Ring)RPushX

func (c Ring) RPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Ring)RandomKey

func (c Ring) RandomKey(ctxcontext.Context) *StringCmd

func (Ring)ReadOnly

func (c Ring) ReadOnly(ctxcontext.Context) *StatusCmd

func (Ring)ReadWrite

func (c Ring) ReadWrite(ctxcontext.Context) *StatusCmd

func (Ring)Rename

func (c Ring) Rename(ctxcontext.Context, key, newkeystring) *StatusCmd

func (Ring)RenameNX

func (c Ring) RenameNX(ctxcontext.Context, key, newkeystring) *BoolCmd

func (Ring)Restore

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

func (Ring)RestoreReplace

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

func (Ring)SAdd

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

func (Ring)SCard

func (c Ring) SCard(ctxcontext.Context, keystring) *IntCmd

func (Ring)SDiff

func (c Ring) SDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Ring)SDiffStore

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

func (Ring)SInter

func (c Ring) SInter(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Ring)SInterStore

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

func (Ring)SIsMember

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

func (Ring)SMIsMemberadded inv8.8.3

func (c Ring) SMIsMember(ctxcontext.Context, keystring, members ...interface{}) *BoolSliceCmd

SMIsMember Redis `SMISMEMBER key member [member ...]` command.

func (Ring)SMembers

func (c Ring) SMembers(ctxcontext.Context, keystring) *StringSliceCmd

SMembers Redis `SMEMBERS key` command output as a slice.

func (Ring)SMembersMap

func (c Ring) SMembersMap(ctxcontext.Context, keystring) *StringStructMapCmd

SMembersMap Redis `SMEMBERS key` command output as a map.

func (Ring)SMove

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

func (Ring)SPop

func (c Ring) SPop(ctxcontext.Context, keystring) *StringCmd

SPop Redis `SPOP key` command.

func (Ring)SPopN

func (c Ring) SPopN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SPopN Redis `SPOP key count` command.

func (Ring)SRandMember

func (c Ring) SRandMember(ctxcontext.Context, keystring) *StringCmd

SRandMember Redis `SRANDMEMBER key` command.

func (Ring)SRandMemberN

func (c Ring) SRandMemberN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SRandMemberN Redis `SRANDMEMBER key count` command.

func (Ring)SRem

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

func (Ring)SScan

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

func (Ring)SUnion

func (c Ring) SUnion(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Ring)SUnionStore

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

func (Ring)Save

func (c Ring) Save(ctxcontext.Context) *StatusCmd

func (Ring)Scan

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

func (Ring)ScanTypeadded inv8.4.7

func (c Ring) ScanType(ctxcontext.Context, cursoruint64, matchstring, countint64, keyTypestring) *ScanCmd

func (Ring)ScriptExists

func (c Ring) ScriptExists(ctxcontext.Context, hashes ...string) *BoolSliceCmd

func (Ring)ScriptFlush

func (c Ring) ScriptFlush(ctxcontext.Context) *StatusCmd

func (Ring)ScriptKill

func (c Ring) ScriptKill(ctxcontext.Context) *StatusCmd

func (Ring)ScriptLoad

func (c Ring) ScriptLoad(ctxcontext.Context, scriptstring) *StringCmd

func (Ring)Set

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

Set Redis `SET key value [expiration]` command.Use expiration for `SETEX`-like behavior.

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Ring)SetArgsadded inv8.6.0

func (c Ring) SetArgs(ctxcontext.Context, keystring, value interface{}, aSetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports.It is the alternative to the Set function when you wantto have more control over the options.

func (Ring)SetBit

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

func (Ring)SetEXadded inv8.3.3

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

SetEX Redis `SETEX key expiration value` command.

func (Ring)SetNX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Ring)SetRange

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

func (Ring)SetXX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Ring)Shutdown

func (c Ring) Shutdown(ctxcontext.Context) *StatusCmd

func (Ring)ShutdownNoSave

func (c Ring) ShutdownNoSave(ctxcontext.Context) *StatusCmd

func (Ring)ShutdownSave

func (c Ring) ShutdownSave(ctxcontext.Context) *StatusCmd

func (Ring)SlaveOf

func (c Ring) SlaveOf(ctxcontext.Context, host, portstring) *StatusCmd

func (Ring)SlowLogGet

func (c Ring) SlowLogGet(ctxcontext.Context, numint64) *SlowLogCmd

func (Ring)Sort

func (c Ring) Sort(ctxcontext.Context, keystring, sort *Sort) *StringSliceCmd

func (Ring)SortInterfaces

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

func (Ring)SortStore

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

func (Ring)StrLen

func (c Ring) StrLen(ctxcontext.Context, keystring) *IntCmd

func (*Ring)Subscribe

func (c *Ring) Subscribe(ctxcontext.Context, channels ...string) *PubSub

Subscribe subscribes the client to the specified channels.

func (Ring)Sync

func (c Ring) Sync(_context.Context)

func (Ring)TTL

func (c Ring) TTL(ctxcontext.Context, keystring) *DurationCmd

func (Ring)Time

func (c Ring) Time(ctxcontext.Context) *TimeCmd

func (Ring)Touch

func (c Ring) Touch(ctxcontext.Context, keys ...string) *IntCmd

func (*Ring)TxPipeline

func (c *Ring) TxPipeline()Pipeliner

func (*Ring)TxPipelined

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

func (Ring)Type

func (c Ring) Type(ctxcontext.Context, keystring) *StatusCmd

func (Ring)Unlink

func (c Ring) Unlink(ctxcontext.Context, keys ...string) *IntCmd

func (Ring)Wait

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

func (*Ring)Watch

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

func (*Ring)WithContext

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

func (Ring)XAck

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

func (Ring)XAdd

func (c Ring) XAdd(ctxcontext.Context, a *XAddArgs) *StringCmd

XAdd a.Limit has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046

func (Ring)XAutoClaimadded inv8.11.0

func (c Ring) XAutoClaim(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimCmd

func (Ring)XAutoClaimJustIDadded inv8.11.0

func (c Ring) XAutoClaimJustID(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd

func (Ring)XClaim

func (c Ring) XClaim(ctxcontext.Context, a *XClaimArgs) *XMessageSliceCmd

func (Ring)XClaimJustID

func (c Ring) XClaimJustID(ctxcontext.Context, a *XClaimArgs) *StringSliceCmd

func (Ring)XDel

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

func (Ring)XGroupCreate

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

func (Ring)XGroupCreateConsumeradded inv8.11.0

func (c Ring) XGroupCreateConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmd

func (Ring)XGroupCreateMkStream

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

func (Ring)XGroupDelConsumer

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

func (Ring)XGroupDestroy

func (c Ring) XGroupDestroy(ctxcontext.Context, stream, groupstring) *IntCmd

func (Ring)XGroupSetID

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

func (Ring)XInfoConsumersadded inv8.6.0

func (c Ring) XInfoConsumers(ctxcontext.Context, keystring, groupstring) *XInfoConsumersCmd

func (Ring)XInfoGroups

func (c Ring) XInfoGroups(ctxcontext.Context, keystring) *XInfoGroupsCmd

func (Ring)XInfoStreamadded inv8.2.1

func (c Ring) XInfoStream(ctxcontext.Context, keystring) *XInfoStreamCmd

func (Ring)XInfoStreamFulladded inv8.9.0

func (c Ring) XInfoStreamFull(ctxcontext.Context, keystring, countint) *XInfoStreamFullCmd

XInfoStreamFull XINFO STREAM FULL [COUNT count]redis-server >= 6.0.

func (Ring)XLen

func (c Ring) XLen(ctxcontext.Context, streamstring) *IntCmd

func (Ring)XPending

func (c Ring) XPending(ctxcontext.Context, stream, groupstring) *XPendingCmd

func (Ring)XPendingExt

func (c Ring) XPendingExt(ctxcontext.Context, a *XPendingExtArgs) *XPendingExtCmd

func (Ring)XRange

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

func (Ring)XRangeN

func (c Ring) XRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmd

func (Ring)XRead

func (c Ring) XRead(ctxcontext.Context, a *XReadArgs) *XStreamSliceCmd

func (Ring)XReadGroup

func (c Ring) XReadGroup(ctxcontext.Context, a *XReadGroupArgs) *XStreamSliceCmd

func (Ring)XReadStreams

func (c Ring) XReadStreams(ctxcontext.Context, streams ...string) *XStreamSliceCmd

func (Ring)XRevRange

func (c Ring) XRevRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmd

func (Ring)XRevRangeN

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

func (Ring)XTrimdeprecated

func (c Ring) XTrim(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLen, remove in v9.

func (Ring)XTrimApproxdeprecated

func (c Ring) XTrimApprox(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLenApprox, remove in v9.

func (Ring)XTrimMaxLenadded inv8.11.0

func (c Ring) XTrimMaxLen(ctxcontext.Context, keystring, maxLenint64) *IntCmd

XTrimMaxLen No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MAXLEN maxLen

func (Ring)XTrimMaxLenApproxadded inv8.11.0

func (c Ring) XTrimMaxLenApprox(ctxcontext.Context, keystring, maxLen, limitint64) *IntCmd

XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit

func (Ring)XTrimMinIDadded inv8.11.0

func (c Ring) XTrimMinID(ctxcontext.Context, keystring, minIDstring) *IntCmd

XTrimMinID No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MINID minID

func (Ring)XTrimMinIDApproxadded inv8.11.0

func (c Ring) XTrimMinIDApprox(ctxcontext.Context, keystring, minIDstring, limitint64) *IntCmd

XTrimMinIDApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MINID ~ minID LIMIT limit

func (Ring)ZAdd

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

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

func (Ring)ZAddArgsadded inv8.11.0

func (c Ring) ZAddArgs(ctxcontext.Context, keystring, argsZAddArgs) *IntCmd

func (Ring)ZAddArgsIncradded inv8.11.0

func (c Ring) ZAddArgsIncr(ctxcontext.Context, keystring, argsZAddArgs) *FloatCmd

func (Ring)ZAddCh

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

ZAddCh Redis `ZADD key CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{Ch: true,Members: []Z,})remove in v9.

func (Ring)ZAddNX

func (c Ring) ZAddNX(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Ring)ZAddNXCh

func (c Ring) ZAddNXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{NX: true,Ch: true,Members: []Z,})remove in v9.

func (Ring)ZAddXX

func (c Ring) ZAddXX(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Ring)ZAddXXCh

func (c Ring) ZAddXXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{XX: true,Ch: true,Members: []Z,})remove in v9.

func (Ring)ZCard

func (c Ring) ZCard(ctxcontext.Context, keystring) *IntCmd

func (Ring)ZCount

func (c Ring) ZCount(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Ring)ZDiffadded inv8.9.0

func (c Ring) ZDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

ZDiff redis-server version >= 6.2.0.

func (Ring)ZDiffStoreadded inv8.10.0

func (c Ring) ZDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

ZDiffStore redis-server version >=6.2.0.

func (Ring)ZDiffWithScoresadded inv8.9.0

func (c Ring) ZDiffWithScores(ctxcontext.Context, keys ...string) *ZSliceCmd

ZDiffWithScores redis-server version >= 6.2.0.

func (Ring)ZIncr

func (c Ring) ZIncr(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncr Redis `ZADD key INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{Members: []Z,})remove in v9.

func (Ring)ZIncrBy

func (c Ring) ZIncrBy(ctxcontext.Context, keystring, incrementfloat64, memberstring) *FloatCmd

func (Ring)ZIncrNX

func (c Ring) ZIncrNX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrNX Redis `ZADD key NX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{NX: true,Members: []Z,})remove in v9.

func (Ring)ZIncrXX

func (c Ring) ZIncrXX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrXX Redis `ZADD key XX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{XX: true,Members: []Z,})remove in v9.

func (Ring)ZInteradded inv8.10.0

func (c Ring) ZInter(ctxcontext.Context, store *ZStore) *StringSliceCmd

func (Ring)ZInterStore

func (c Ring) ZInterStore(ctxcontext.Context, destinationstring, store *ZStore) *IntCmd

func (Ring)ZInterWithScoresadded inv8.10.0

func (c Ring) ZInterWithScores(ctxcontext.Context, store *ZStore) *ZSliceCmd

func (Ring)ZLexCount

func (c Ring) ZLexCount(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Ring)ZMScoreadded inv8.8.0

func (c Ring) ZMScore(ctxcontext.Context, keystring, members ...string) *FloatSliceCmd

func (Ring)ZPopMax

func (c Ring) ZPopMax(ctxcontext.Context, keystring, count ...int64) *ZSliceCmd

func (Ring)ZPopMin

func (c Ring) ZPopMin(ctxcontext.Context, keystring, count ...int64) *ZSliceCmd

func (Ring)ZRandMemberadded inv8.8.1

func (c Ring) ZRandMember(ctxcontext.Context, keystring, countint, withScoresbool) *StringSliceCmd

ZRandMember redis-server version >= 6.2.0.

func (Ring)ZRange

func (c Ring) ZRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Ring)ZRangeArgsadded inv8.11.0

func (c Ring) ZRangeArgs(ctxcontext.Context, zZRangeArgs) *StringSliceCmd

func (Ring)ZRangeArgsWithScoresadded inv8.11.0

func (c Ring) ZRangeArgsWithScores(ctxcontext.Context, zZRangeArgs) *ZSliceCmd

func (Ring)ZRangeByLex

func (c Ring) ZRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Ring)ZRangeByScore

func (c Ring) ZRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Ring)ZRangeByScoreWithScores

func (c Ring) ZRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Ring)ZRangeStoreadded inv8.11.0

func (c Ring) ZRangeStore(ctxcontext.Context, dststring, zZRangeArgs) *IntCmd

func (Ring)ZRangeWithScores

func (c Ring) ZRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmd

func (Ring)ZRank

func (c Ring) ZRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Ring)ZRem

func (c Ring) ZRem(ctxcontext.Context, keystring, members ...interface{}) *IntCmd

func (Ring)ZRemRangeByLex

func (c Ring) ZRemRangeByLex(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Ring)ZRemRangeByRank

func (c Ring) ZRemRangeByRank(ctxcontext.Context, keystring, start, stopint64) *IntCmd

func (Ring)ZRemRangeByScore

func (c Ring) ZRemRangeByScore(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Ring)ZRevRange

func (c Ring) ZRevRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Ring)ZRevRangeByLex

func (c Ring) ZRevRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Ring)ZRevRangeByScore

func (c Ring) ZRevRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Ring)ZRevRangeByScoreWithScores

func (c Ring) ZRevRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Ring)ZRevRangeWithScores

func (c Ring) ZRevRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmd

func (Ring)ZRevRank

func (c Ring) ZRevRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Ring)ZScan

func (c Ring) ZScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (Ring)ZScore

func (c Ring) ZScore(ctxcontext.Context, key, memberstring) *FloatCmd

func (Ring)ZUnionadded inv8.11.0

func (c Ring) ZUnion(ctxcontext.Context, storeZStore) *StringSliceCmd

func (Ring)ZUnionStore

func (c Ring) ZUnionStore(ctxcontext.Context, deststring, store *ZStore) *IntCmd

func (Ring)ZUnionWithScoresadded inv8.11.0

func (c Ring) ZUnionWithScores(ctxcontext.Context, storeZStore) *ZSliceCmd

typeRingOptions

type RingOptions struct {// Map of name => host:port addresses of ring shards.Addrs map[string]string// NewClient creates a shard client with provided name and options.NewClient func(namestring, opt *Options) *Client// Frequency of PING commands sent to check shards availability.// Shard is considered down after 3 subsequent failed checks.HeartbeatFrequencytime.Duration// NewConsistentHash returns a consistent hash that is used// to distribute keys across the shards.//// Seehttps://medium.com/@dgryski/consistent-hashing-algorithmic-tradeoffs-ef6b8e2fcae8// for consistent hashing algorithmic tradeoffs.NewConsistentHash func(shards []string)ConsistentHashDialer    func(ctxcontext.Context, network, addrstring) (net.Conn,error)OnConnect func(ctxcontext.Context, cn *Conn)errorUsernamestringPasswordstringDBintMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.Duration// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).PoolFIFOboolPoolSizeintMinIdleConnsintMaxConnAgetime.DurationPoolTimeouttime.DurationIdleTimeouttime.DurationIdleCheckFrequencytime.DurationTLSConfig *tls.ConfigLimiterLimiter}

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(ctxcontext.Context, process cmdable, 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)FullName

func (cmd *ScanCmd) FullName()string

func (*ScanCmd)Iterator

func (cmd *ScanCmd) Iterator() *ScanIterator

Iterator creates a new ScanIterator.

Example
iter := rdb.Scan(ctx, 0, "", 0).Iterator()for iter.Next(ctx) {fmt.Println(iter.Val())}if err := iter.Err(); err != nil {panic(err)}

func (*ScanCmd)Name

func (cmd *ScanCmd) Name()string

func (*ScanCmd)Result

func (cmd *ScanCmd) Result() (keys []string, cursoruint64, errerror)

func (*ScanCmd)SetErr

func (cmd *ScanCmd) SetErr(eerror)

func (*ScanCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *ScanCmd) SetFirstKeyPos(keyPosint8)

func (*ScanCmd)SetValadded inv8.11.4

func (cmd *ScanCmd) SetVal(page []string, cursoruint64)

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
iter := rdb.Scan(ctx, 0, "", 0).Iterator()for iter.Next(ctx) {fmt.Println(iter.Val())}if err := iter.Err(); err != nil {panic(err)}

func (*ScanIterator)Err

func (it *ScanIterator) Err()error

Err returns the last iterator error, if any.

func (*ScanIterator)Next

func (it *ScanIterator) Next(ctxcontext.Context)bool

Next advances the cursor and returns true if more values can be read.

func (*ScanIterator)Val

func (it *ScanIterator) Val()string

Val returns the key/field at the current cursor position.

typeScript

type Script struct {// contains filtered or unexported fields}
Example
IncrByXX := redis.NewScript(`if redis.call("GET", KEYS[1]) ~= false thenreturn redis.call("INCRBY", KEYS[1], ARGV[1])endreturn false`)n, err := IncrByXX.Run(ctx, rdb, []string{"xx_counter"}, 2).Result()fmt.Println(n, err)err = rdb.Set(ctx, "xx_counter", "40", 0).Err()if err != nil {panic(err)}n, err = IncrByXX.Run(ctx, rdb, []string{"xx_counter"}, 2).Result()fmt.Println(n, err)
Output:<nil> redis: nil42 <nil>

funcNewScript

func NewScript(srcstring) *Script

func (*Script)Eval

func (s *Script) Eval(ctxcontext.Context, cScripter, keys []string, args ...interface{}) *Cmd

func (*Script)EvalSha

func (s *Script) EvalSha(ctxcontext.Context, cScripter, keys []string, args ...interface{}) *Cmd

func (*Script)Exists

func (s *Script) Exists(ctxcontext.Context, cScripter) *BoolSliceCmd

func (*Script)Hash

func (s *Script) Hash()string

func (*Script)Load

func (s *Script) Load(ctxcontext.Context, cScripter) *StringCmd

func (*Script)Run

func (s *Script) Run(ctxcontext.Context, cScripter, keys []string, args ...interface{}) *Cmd

Run optimistically uses EVALSHA to run the script. If script does not existit is retried using EVAL.

typeScripteradded inv8.4.11

type Scripter interface {Eval(ctxcontext.Context, scriptstring, keys []string, args ...interface{}) *CmdEvalSha(ctxcontext.Context, sha1string, keys []string, args ...interface{}) *CmdScriptExists(ctxcontext.Context, hashes ...string) *BoolSliceCmdScriptLoad(ctxcontext.Context, scriptstring) *StringCmd}

typeSentinelClient

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

SentinelClient is a client for a Redis Sentinel.

funcNewSentinelClient

func NewSentinelClient(opt *Options) *SentinelClient

func (*SentinelClient)AddHookadded inv8.1.0

func (hs *SentinelClient) AddHook(hookHook)

func (*SentinelClient)CkQuorum

func (c *SentinelClient) CkQuorum(ctxcontext.Context, namestring) *StringCmd

CkQuorum checks if the current Sentinel configuration is able to reach thequorum needed to failover a master, and the majority needed to authorize thefailover. This command should be used in monitoring systems to check if aSentinel deployment is ok.

func (SentinelClient)Close

func (c SentinelClient) Close()error

Close closes the client, releasing any open resources.

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

func (*SentinelClient)Context

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

func (*SentinelClient)Failover

func (c *SentinelClient) Failover(ctxcontext.Context, 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(ctxcontext.Context) *StatusCmd

FlushConfig forces Sentinel to rewrite its configuration on disk, includingthe current Sentinel state.

func (*SentinelClient)GetMasterAddrByName

func (c *SentinelClient) GetMasterAddrByName(ctxcontext.Context, namestring) *StringSliceCmd

func (*SentinelClient)Master

Master shows the state and info of the specified master.

func (*SentinelClient)Masters

func (c *SentinelClient) Masters(ctxcontext.Context) *SliceCmd

Masters shows a list of monitored masters and their state.

func (*SentinelClient)Monitor

func (c *SentinelClient) Monitor(ctxcontext.Context, name, ip, port, quorumstring) *StringCmd

Monitor tells the Sentinel to start monitoring a new master with the specifiedname, ip, port, and quorum.

func (*SentinelClient)PSubscribe

func (c *SentinelClient) PSubscribe(ctxcontext.Context, channels ...string) *PubSub

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

func (*SentinelClient)Ping

Ping is used to test if a connection is still alive, or tomeasure latency.

func (*SentinelClient)Process

func (c *SentinelClient) Process(ctxcontext.Context, cmdCmder)error

func (*SentinelClient)Remove

func (c *SentinelClient) Remove(ctxcontext.Context, namestring) *StringCmd

Remove is used in order to remove the specified master: the master will nolonger be monitored, and will totally be removed from the internal state ofthe Sentinel.

func (*SentinelClient)Reset

func (c *SentinelClient) Reset(ctxcontext.Context, 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(ctxcontext.Context, namestring) *SliceCmd

func (*SentinelClient)Set

func (c *SentinelClient) Set(ctxcontext.Context, name, option, valuestring) *StringCmd

Set is used in order to change configuration parameters of a specific master.

func (*SentinelClient)Slaves

func (c *SentinelClient) Slaves(ctxcontext.Context, namestring) *SliceCmd

Slaves shows a list of slaves for the specified master and their state.

func (SentinelClient)String

func (c SentinelClient) String()string

func (*SentinelClient)Subscribe

func (c *SentinelClient) Subscribe(ctxcontext.Context, channels ...string) *PubSub

Subscribe subscribes the client to the specified channels.Channels can be omitted to create empty subscription.

func (*SentinelClient)WithContext

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

typeSetArgsadded inv8.6.0

type SetArgs struct {// Mode can be `NX` or `XX` or empty.Modestring// Zero `TTL` or `Expiration` means that the key has no expiration time.TTLtime.DurationExpireAttime.Time// When Get is true, the command returns the old value stored at key, or nil when key did not exist.Getbool// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,// otherwise you will receive an error: (error) ERR syntax error.KeepTTLbool}

SetArgs provides arguments for the SetArgs function.

typeSliceCmd

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

funcNewSliceCmd

func NewSliceCmd(ctxcontext.Context, 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)FullName

func (cmd *SliceCmd) FullName()string

func (*SliceCmd)Name

func (cmd *SliceCmd) Name()string

func (*SliceCmd)Result

func (cmd *SliceCmd) Result() ([]interface{},error)

func (*SliceCmd)Scanadded inv8.5.0

func (cmd *SliceCmd) Scan(dst interface{})error

Scan scans the results from the map into a destination struct. The map keysare matched in the Redis struct fields by the `redis:"field"` tag.

Example

ExampleSliceCmd_Scan shows how to scan the results of a multi key fetchinto a struct.

rdb.FlushDB(ctx)err := rdb.MSet(ctx,"name", "hello","count", 123,"correct", true).Err()if err != nil {panic(err)}res := rdb.MGet(ctx, "name", "count", "empty", "correct")if res.Err() != nil {panic(err)}type data struct {Name    string `redis:"name"`Count   int    `redis:"count"`Correct bool   `redis:"correct"`}// Scan the results into the struct.var d dataif err := res.Scan(&d); err != nil {panic(err)}fmt.Println(d)
Output:{hello 123 true}

func (*SliceCmd)SetErr

func (cmd *SliceCmd) SetErr(eerror)

func (*SliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *SliceCmd) SetFirstKeyPos(keyPosint8)

func (*SliceCmd)SetValadded inv8.11.4

func (cmd *SliceCmd) SetVal(val []interface{})

func (*SliceCmd)String

func (cmd *SliceCmd) String()string

func (*SliceCmd)Val

func (cmd *SliceCmd) Val() []interface{}

typeSlowLog

type SlowLog struct {IDint64Timetime.TimeDurationtime.DurationArgs     []string// These are also optional fields emitted only by Redis 4.0 or greater://https://redis.io/commands/slowlog#output-formatClientAddrstringClientNamestring}

typeSlowLogCmd

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

funcNewSlowLogCmd

func NewSlowLogCmd(ctxcontext.Context, args ...interface{}) *SlowLogCmd

func (*SlowLogCmd)Args

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

func (*SlowLogCmd)Err

func (cmd *SlowLogCmd) Err()error

func (*SlowLogCmd)FullName

func (cmd *SlowLogCmd) FullName()string

func (*SlowLogCmd)Name

func (cmd *SlowLogCmd) Name()string

func (*SlowLogCmd)Result

func (cmd *SlowLogCmd) Result() ([]SlowLog,error)

func (*SlowLogCmd)SetErr

func (cmd *SlowLogCmd) SetErr(eerror)

func (*SlowLogCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *SlowLogCmd) SetFirstKeyPos(keyPosint8)

func (*SlowLogCmd)SetValadded inv8.11.4

func (cmd *SlowLogCmd) SetVal(val []SlowLog)

func (*SlowLogCmd)String

func (cmd *SlowLogCmd) String()string

func (*SlowLogCmd)Val

func (cmd *SlowLogCmd) Val() []SlowLog

typeSort

type Sort struct {BystringOffset, Countint64Get           []stringOrderstringAlphabool}

typeStatefulCmdable

type StatefulCmdable interface {CmdableAuth(ctxcontext.Context, passwordstring) *StatusCmdAuthACL(ctxcontext.Context, username, passwordstring) *StatusCmdSelect(ctxcontext.Context, indexint) *StatusCmdSwapDB(ctxcontext.Context, index1, index2int) *StatusCmdClientSetName(ctxcontext.Context, namestring) *BoolCmd}

typeStatusCmd

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

funcNewStatusCmd

func NewStatusCmd(ctxcontext.Context, 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)FullName

func (cmd *StatusCmd) FullName()string

func (*StatusCmd)Name

func (cmd *StatusCmd) Name()string

func (*StatusCmd)Result

func (cmd *StatusCmd) Result() (string,error)

func (*StatusCmd)SetErr

func (cmd *StatusCmd) SetErr(eerror)

func (*StatusCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *StatusCmd) SetFirstKeyPos(keyPosint8)

func (*StatusCmd)SetValadded inv8.11.4

func (cmd *StatusCmd) SetVal(valstring)

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(ctxcontext.Context, 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)Booladded inv8.8.0

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

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

func (cmd *StringCmd) FullName()string

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

func (cmd *StringCmd) SetErr(eerror)

func (*StringCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *StringCmd) SetFirstKeyPos(keyPosint8)

func (*StringCmd)SetValadded inv8.11.4

func (cmd *StringCmd) SetVal(valstring)

func (*StringCmd)String

func (cmd *StringCmd) String()string

func (*StringCmd)Time

func (cmd *StringCmd) Time() (time.Time,error)

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(ctxcontext.Context, 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)FullName

func (cmd *StringIntMapCmd) FullName()string

func (*StringIntMapCmd)Name

func (cmd *StringIntMapCmd) Name()string

func (*StringIntMapCmd)Result

func (cmd *StringIntMapCmd) Result() (map[string]int64,error)

func (*StringIntMapCmd)SetErr

func (cmd *StringIntMapCmd) SetErr(eerror)

func (*StringIntMapCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *StringIntMapCmd) SetFirstKeyPos(keyPosint8)

func (*StringIntMapCmd)SetValadded inv8.11.4

func (cmd *StringIntMapCmd) SetVal(val map[string]int64)

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(ctxcontext.Context, 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)FullName

func (cmd *StringSliceCmd) FullName()string

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

func (cmd *StringSliceCmd) SetErr(eerror)

func (*StringSliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *StringSliceCmd) SetFirstKeyPos(keyPosint8)

func (*StringSliceCmd)SetValadded inv8.11.4

func (cmd *StringSliceCmd) SetVal(val []string)

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(ctxcontext.Context, 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)FullName

func (cmd *StringStringMapCmd) FullName()string

func (*StringStringMapCmd)Name

func (cmd *StringStringMapCmd) Name()string

func (*StringStringMapCmd)Result

func (cmd *StringStringMapCmd) Result() (map[string]string,error)

func (*StringStringMapCmd)Scanadded inv8.5.0

func (cmd *StringStringMapCmd) Scan(dest interface{})error

Scan scans the results from the map into a destination struct. The map keysare matched in the Redis struct fields by the `redis:"field"` tag.

Example

ExampleStringStringMapCmd_Scan shows how to scan the results of a map fetchinto a struct.

rdb.FlushDB(ctx)err := rdb.HMSet(ctx, "map","name", "hello","count", 123,"correct", true).Err()if err != nil {panic(err)}// Get the map. The same approach works for HmGet().res := rdb.HGetAll(ctx, "map")if res.Err() != nil {panic(err)}type data struct {Name    string `redis:"name"`Count   int    `redis:"count"`Correct bool   `redis:"correct"`}// Scan the results into the struct.var d dataif err := res.Scan(&d); err != nil {panic(err)}fmt.Println(d)
Output:{hello 123 true}

func (*StringStringMapCmd)SetErr

func (cmd *StringStringMapCmd) SetErr(eerror)

func (*StringStringMapCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *StringStringMapCmd) SetFirstKeyPos(keyPosint8)

func (*StringStringMapCmd)SetValadded inv8.11.4

func (cmd *StringStringMapCmd) SetVal(val map[string]string)

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(ctxcontext.Context, args ...interface{}) *StringStructMapCmd

func (*StringStructMapCmd)Args

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

func (*StringStructMapCmd)Err

func (cmd *StringStructMapCmd) Err()error

func (*StringStructMapCmd)FullName

func (cmd *StringStructMapCmd) FullName()string

func (*StringStructMapCmd)Name

func (cmd *StringStructMapCmd) Name()string

func (*StringStructMapCmd)Result

func (cmd *StringStructMapCmd) Result() (map[string]struct{},error)

func (*StringStructMapCmd)SetErr

func (cmd *StringStructMapCmd) SetErr(eerror)

func (*StringStructMapCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *StringStructMapCmd) SetFirstKeyPos(keyPosint8)

func (*StringStructMapCmd)SetValadded inv8.11.4

func (cmd *StringStructMapCmd) SetVal(val map[string]struct{})

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(ctxcontext.Context, args ...interface{}) *TimeCmd

funcNewTimeCmdResult

func NewTimeCmdResult(valtime.Time, errerror) *TimeCmd

NewTimeCmdResult returns a TimeCmd initialised with val and err for testing.

func (*TimeCmd)Args

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

func (*TimeCmd)Err

func (cmd *TimeCmd) Err()error

func (*TimeCmd)FullName

func (cmd *TimeCmd) FullName()string

func (*TimeCmd)Name

func (cmd *TimeCmd) Name()string

func (*TimeCmd)Result

func (cmd *TimeCmd) Result() (time.Time,error)

func (*TimeCmd)SetErr

func (cmd *TimeCmd) SetErr(eerror)

func (*TimeCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *TimeCmd) SetFirstKeyPos(keyPosint8)

func (*TimeCmd)SetValadded inv8.11.4

func (cmd *TimeCmd) SetVal(valtime.Time)

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, use Pipeline instead.

func (*Tx)AddHook

func (hs *Tx) AddHook(hookHook)

func (Tx)Append

func (c Tx) Append(ctxcontext.Context, key, valuestring) *IntCmd

func (Tx)Auth

func (c Tx) Auth(ctxcontext.Context, passwordstring) *StatusCmd

func (Tx)AuthACL

func (c Tx) AuthACL(ctxcontext.Context, username, passwordstring) *StatusCmd

AuthACL Perform an AUTH command, using the given user and pass.Should be used to authenticate the current connection with one of the connections defined in the ACL listwhen connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system.

func (Tx)BLMoveadded inv8.11.4

func (c Tx) BLMove(ctxcontext.Context, source, destination, srcpos, destposstring, timeouttime.Duration,) *StringCmd

func (Tx)BLPop

func (c Tx) BLPop(ctxcontext.Context, timeouttime.Duration, keys ...string) *StringSliceCmd

func (Tx)BRPop

func (c Tx) BRPop(ctxcontext.Context, timeouttime.Duration, keys ...string) *StringSliceCmd

func (Tx)BRPopLPush

func (c Tx) BRPopLPush(ctxcontext.Context, source, destinationstring, timeouttime.Duration) *StringCmd

func (Tx)BZPopMax

func (c Tx) BZPopMax(ctxcontext.Context, timeouttime.Duration, keys ...string) *ZWithKeyCmd

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

func (Tx)BZPopMin

func (c Tx) BZPopMin(ctxcontext.Context, timeouttime.Duration, keys ...string) *ZWithKeyCmd

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

func (Tx)BgRewriteAOF

func (c Tx) BgRewriteAOF(ctxcontext.Context) *StatusCmd

func (Tx)BgSave

func (c Tx) BgSave(ctxcontext.Context) *StatusCmd

func (Tx)BitCount

func (c Tx) BitCount(ctxcontext.Context, keystring, bitCount *BitCount) *IntCmd

func (Tx)BitField

func (c Tx) BitField(ctxcontext.Context, keystring, args ...interface{}) *IntSliceCmd

func (Tx)BitOpAnd

func (c Tx) BitOpAnd(ctxcontext.Context, destKeystring, keys ...string) *IntCmd

func (Tx)BitOpNot

func (c Tx) BitOpNot(ctxcontext.Context, destKeystring, keystring) *IntCmd

func (Tx)BitOpOr

func (c Tx) BitOpOr(ctxcontext.Context, destKeystring, keys ...string) *IntCmd

func (Tx)BitOpXor

func (c Tx) BitOpXor(ctxcontext.Context, destKeystring, keys ...string) *IntCmd

func (Tx)BitPos

func (c Tx) BitPos(ctxcontext.Context, keystring, bitint64, pos ...int64) *IntCmd

func (Tx)ClientGetName

func (c Tx) ClientGetName(ctxcontext.Context) *StringCmd

ClientGetName returns the name of the connection.

func (Tx)ClientID

func (c Tx) ClientID(ctxcontext.Context) *IntCmd

func (Tx)ClientKill

func (c Tx) ClientKill(ctxcontext.Context, ipPortstring) *StatusCmd

func (Tx)ClientKillByFilter

func (c Tx) ClientKillByFilter(ctxcontext.Context, keys ...string) *IntCmd

ClientKillByFilter is new style syntax, while the ClientKill is old

CLIENT KILL <option> [value] ... <option> [value]

func (Tx)ClientList

func (c Tx) ClientList(ctxcontext.Context) *StringCmd

func (Tx)ClientPause

func (c Tx) ClientPause(ctxcontext.Context, durtime.Duration) *BoolCmd

func (Tx)ClientSetName

func (c Tx) ClientSetName(ctxcontext.Context, namestring) *BoolCmd

ClientSetName assigns a name to the connection.

func (Tx)ClientUnblock

func (c Tx) ClientUnblock(ctxcontext.Context, idint64) *IntCmd

func (Tx)ClientUnblockWithError

func (c Tx) ClientUnblockWithError(ctxcontext.Context, idint64) *IntCmd

func (*Tx)Close

func (c *Tx) Close(ctxcontext.Context)error

Close closes the transaction, releasing any open resources.

func (Tx)ClusterAddSlots

func (c Tx) ClusterAddSlots(ctxcontext.Context, slots ...int) *StatusCmd

func (Tx)ClusterAddSlotsRange

func (c Tx) ClusterAddSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Tx)ClusterCountFailureReports

func (c Tx) ClusterCountFailureReports(ctxcontext.Context, nodeIDstring) *IntCmd

func (Tx)ClusterCountKeysInSlot

func (c Tx) ClusterCountKeysInSlot(ctxcontext.Context, slotint) *IntCmd

func (Tx)ClusterDelSlots

func (c Tx) ClusterDelSlots(ctxcontext.Context, slots ...int) *StatusCmd

func (Tx)ClusterDelSlotsRange

func (c Tx) ClusterDelSlotsRange(ctxcontext.Context, min, maxint) *StatusCmd

func (Tx)ClusterFailover

func (c Tx) ClusterFailover(ctxcontext.Context) *StatusCmd

func (Tx)ClusterForget

func (c Tx) ClusterForget(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Tx)ClusterGetKeysInSlot

func (c Tx) ClusterGetKeysInSlot(ctxcontext.Context, slotint, countint) *StringSliceCmd

func (Tx)ClusterInfo

func (c Tx) ClusterInfo(ctxcontext.Context) *StringCmd

func (Tx)ClusterKeySlot

func (c Tx) ClusterKeySlot(ctxcontext.Context, keystring) *IntCmd

func (Tx)ClusterMeet

func (c Tx) ClusterMeet(ctxcontext.Context, host, portstring) *StatusCmd

func (Tx)ClusterNodes

func (c Tx) ClusterNodes(ctxcontext.Context) *StringCmd

func (Tx)ClusterReplicate

func (c Tx) ClusterReplicate(ctxcontext.Context, nodeIDstring) *StatusCmd

func (Tx)ClusterResetHard

func (c Tx) ClusterResetHard(ctxcontext.Context) *StatusCmd

func (Tx)ClusterResetSoft

func (c Tx) ClusterResetSoft(ctxcontext.Context) *StatusCmd

func (Tx)ClusterSaveConfig

func (c Tx) ClusterSaveConfig(ctxcontext.Context) *StatusCmd

func (Tx)ClusterSlaves

func (c Tx) ClusterSlaves(ctxcontext.Context, nodeIDstring) *StringSliceCmd

func (Tx)ClusterSlots

func (c Tx) ClusterSlots(ctxcontext.Context) *ClusterSlotsCmd

func (Tx)Command

func (c Tx) Command(ctxcontext.Context) *CommandsInfoCmd

func (Tx)ConfigGet

func (c Tx) ConfigGet(ctxcontext.Context, parameterstring) *SliceCmd

func (Tx)ConfigResetStat

func (c Tx) ConfigResetStat(ctxcontext.Context) *StatusCmd

func (Tx)ConfigRewrite

func (c Tx) ConfigRewrite(ctxcontext.Context) *StatusCmd

func (Tx)ConfigSet

func (c Tx) ConfigSet(ctxcontext.Context, parameter, valuestring) *StatusCmd

func (*Tx)Context

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

func (Tx)Copyadded inv8.11.5

func (c Tx) Copy(ctxcontext.Context, sourceKey, destKeystring, dbint, replacebool) *IntCmd

func (Tx)DBSize

func (c Tx) DBSize(ctxcontext.Context) *IntCmd

func (Tx)DebugObject

func (c Tx) DebugObject(ctxcontext.Context, keystring) *StringCmd

func (Tx)Decr

func (c Tx) Decr(ctxcontext.Context, keystring) *IntCmd

func (Tx)DecrBy

func (c Tx) DecrBy(ctxcontext.Context, keystring, decrementint64) *IntCmd

func (Tx)Del

func (c Tx) Del(ctxcontext.Context, keys ...string) *IntCmd

func (Tx)Dump

func (c Tx) Dump(ctxcontext.Context, keystring) *StringCmd

func (Tx)Echo

func (c Tx) Echo(ctxcontext.Context, message interface{}) *StringCmd

func (Tx)Eval

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

func (Tx)EvalSha

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

func (Tx)Exists

func (c Tx) Exists(ctxcontext.Context, keys ...string) *IntCmd

func (Tx)Expire

func (c Tx) Expire(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Tx)ExpireAt

func (c Tx) ExpireAt(ctxcontext.Context, keystring, tmtime.Time) *BoolCmd

func (Tx)ExpireGTadded inv8.11.5

func (c Tx) ExpireGT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Tx)ExpireLTadded inv8.11.5

func (c Tx) ExpireLT(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Tx)ExpireNXadded inv8.11.5

func (c Tx) ExpireNX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Tx)ExpireXXadded inv8.11.5

func (c Tx) ExpireXX(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Tx)FlushAll

func (c Tx) FlushAll(ctxcontext.Context) *StatusCmd

func (Tx)FlushAllAsync

func (c Tx) FlushAllAsync(ctxcontext.Context) *StatusCmd

func (Tx)FlushDB

func (c Tx) FlushDB(ctxcontext.Context) *StatusCmd

func (Tx)FlushDBAsync

func (c Tx) FlushDBAsync(ctxcontext.Context) *StatusCmd

func (Tx)GeoAdd

func (c Tx) GeoAdd(ctxcontext.Context, keystring, geoLocation ...*GeoLocation) *IntCmd

func (Tx)GeoDist

func (c Tx) GeoDist(ctxcontext.Context, keystring, member1, member2, unitstring,) *FloatCmd

func (Tx)GeoHash

func (c Tx) GeoHash(ctxcontext.Context, keystring, members ...string) *StringSliceCmd

func (Tx)GeoPos

func (c Tx) GeoPos(ctxcontext.Context, keystring, members ...string) *GeoPosCmd

func (Tx)GeoRadius

func (c Tx) GeoRadius(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery,) *GeoLocationCmd

GeoRadius is a read-only GEORADIUS_RO command.

func (Tx)GeoRadiusByMember

func (c Tx) GeoRadiusByMember(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery,) *GeoLocationCmd

GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.

func (Tx)GeoRadiusByMemberStore

func (c Tx) GeoRadiusByMemberStore(ctxcontext.Context, key, memberstring, query *GeoRadiusQuery,) *IntCmd

GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.

func (Tx)GeoRadiusStore

func (c Tx) GeoRadiusStore(ctxcontext.Context, keystring, longitude, latitudefloat64, query *GeoRadiusQuery,) *IntCmd

GeoRadiusStore is a writing GEORADIUS command.

func (Tx)GeoSearchadded inv8.11.1

func (c Tx) GeoSearch(ctxcontext.Context, keystring, q *GeoSearchQuery) *StringSliceCmd

func (Tx)GeoSearchLocationadded inv8.11.1

func (c Tx) GeoSearchLocation(ctxcontext.Context, keystring, q *GeoSearchLocationQuery,) *GeoSearchLocationCmd

func (Tx)GeoSearchStoreadded inv8.11.1

func (c Tx) GeoSearchStore(ctxcontext.Context, key, storestring, q *GeoSearchStoreQuery) *IntCmd

func (Tx)Get

func (c Tx) Get(ctxcontext.Context, keystring) *StringCmd

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

func (Tx)GetBit

func (c Tx) GetBit(ctxcontext.Context, keystring, offsetint64) *IntCmd

func (Tx)GetDeladded inv8.8.1

func (c Tx) GetDel(ctxcontext.Context, keystring) *StringCmd

GetDel redis-server version >= 6.2.0.

func (Tx)GetExadded inv8.8.1

func (c Tx) GetEx(ctxcontext.Context, keystring, expirationtime.Duration) *StringCmd

GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist).Requires Redis >= 6.2.0.

func (Tx)GetRange

func (c Tx) GetRange(ctxcontext.Context, keystring, start, endint64) *StringCmd

func (Tx)GetSet

func (c Tx) GetSet(ctxcontext.Context, keystring, value interface{}) *StringCmd

func (Tx)HDel

func (c Tx) HDel(ctxcontext.Context, keystring, fields ...string) *IntCmd

func (Tx)HExists

func (c Tx) HExists(ctxcontext.Context, key, fieldstring) *BoolCmd

func (Tx)HGet

func (c Tx) HGet(ctxcontext.Context, key, fieldstring) *StringCmd

func (Tx)HGetAll

func (c Tx) HGetAll(ctxcontext.Context, keystring) *StringStringMapCmd

func (Tx)HIncrBy

func (c Tx) HIncrBy(ctxcontext.Context, key, fieldstring, incrint64) *IntCmd

func (Tx)HIncrByFloat

func (c Tx) HIncrByFloat(ctxcontext.Context, key, fieldstring, incrfloat64) *FloatCmd

func (Tx)HKeys

func (c Tx) HKeys(ctxcontext.Context, keystring) *StringSliceCmd

func (Tx)HLen

func (c Tx) HLen(ctxcontext.Context, keystring) *IntCmd

func (Tx)HMGet

func (c Tx) HMGet(ctxcontext.Context, keystring, fields ...string) *SliceCmd

HMGet returns the values for the specified fields in the hash stored at key.It returns an interface{} to distinguish between empty string and nil value.

func (Tx)HMSet

func (c Tx) HMSet(ctxcontext.Context, keystring, values ...interface{}) *BoolCmd

HMSet is a deprecated version of HSet left for compatibility with Redis 3.

func (Tx)HRandFieldadded inv8.8.1

func (c Tx) HRandField(ctxcontext.Context, keystring, countint, withValuesbool) *StringSliceCmd

HRandField redis-server version >= 6.2.0.

func (Tx)HScan

func (c Tx) HScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (Tx)HSet

func (c Tx) HSet(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

HSet accepts values in following formats:

  • HSet("myhash", "key1", "value1", "key2", "value2")
  • HSet("myhash", []string{"key1", "value1", "key2", "value2"})
  • HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})

Note that it requires Redis v4 for multiple field/value pairs support.

func (Tx)HSetNX

func (c Tx) HSetNX(ctxcontext.Context, key, fieldstring, value interface{}) *BoolCmd

func (Tx)HVals

func (c Tx) HVals(ctxcontext.Context, keystring) *StringSliceCmd

func (Tx)Incr

func (c Tx) Incr(ctxcontext.Context, keystring) *IntCmd

func (Tx)IncrBy

func (c Tx) IncrBy(ctxcontext.Context, keystring, valueint64) *IntCmd

func (Tx)IncrByFloat

func (c Tx) IncrByFloat(ctxcontext.Context, keystring, valuefloat64) *FloatCmd

func (Tx)Info

func (c Tx) Info(ctxcontext.Context, section ...string) *StringCmd

func (Tx)Keys

func (c Tx) Keys(ctxcontext.Context, patternstring) *StringSliceCmd

func (Tx)LIndex

func (c Tx) LIndex(ctxcontext.Context, keystring, indexint64) *StringCmd

func (Tx)LInsert

func (c Tx) LInsert(ctxcontext.Context, key, opstring, pivot, value interface{}) *IntCmd

func (Tx)LInsertAfter

func (c Tx) LInsertAfter(ctxcontext.Context, keystring, pivot, value interface{}) *IntCmd

func (Tx)LInsertBefore

func (c Tx) LInsertBefore(ctxcontext.Context, keystring, pivot, value interface{}) *IntCmd

func (Tx)LLen

func (c Tx) LLen(ctxcontext.Context, keystring) *IntCmd

func (Tx)LMoveadded inv8.8.1

func (c Tx) LMove(ctxcontext.Context, source, destination, srcpos, destposstring) *StringCmd

func (Tx)LPop

func (c Tx) LPop(ctxcontext.Context, keystring) *StringCmd

func (Tx)LPopCountadded inv8.8.3

func (c Tx) LPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Tx)LPosadded inv8.3.4

func (c Tx) LPos(ctxcontext.Context, keystring, valuestring, aLPosArgs) *IntCmd

func (Tx)LPosCountadded inv8.3.4

func (c Tx) LPosCount(ctxcontext.Context, keystring, valuestring, countint64, aLPosArgs) *IntSliceCmd

func (Tx)LPush

func (c Tx) LPush(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Tx)LPushX

func (c Tx) LPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Tx)LRange

func (c Tx) LRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Tx)LRem

func (c Tx) LRem(ctxcontext.Context, keystring, countint64, value interface{}) *IntCmd

func (Tx)LSet

func (c Tx) LSet(ctxcontext.Context, keystring, indexint64, value interface{}) *StatusCmd

func (Tx)LTrim

func (c Tx) LTrim(ctxcontext.Context, keystring, start, stopint64) *StatusCmd

func (Tx)LastSave

func (c Tx) LastSave(ctxcontext.Context) *IntCmd

func (Tx)MGet

func (c Tx) MGet(ctxcontext.Context, keys ...string) *SliceCmd

func (Tx)MSet

func (c Tx) MSet(ctxcontext.Context, values ...interface{}) *StatusCmd

MSet is like Set but accepts multiple values:

  • MSet("key1", "value1", "key2", "value2")
  • MSet([]string{"key1", "value1", "key2", "value2"})
  • MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Tx)MSetNX

func (c Tx) MSetNX(ctxcontext.Context, values ...interface{}) *BoolCmd

MSetNX is like SetNX but accepts multiple values:

  • MSetNX("key1", "value1", "key2", "value2")
  • MSetNX([]string{"key1", "value1", "key2", "value2"})
  • MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})

func (Tx)MemoryUsage

func (c Tx) MemoryUsage(ctxcontext.Context, keystring, samples ...int) *IntCmd

func (Tx)Migrate

func (c Tx) Migrate(ctxcontext.Context, host, port, keystring, dbint, timeouttime.Duration) *StatusCmd

func (Tx)Move

func (c Tx) Move(ctxcontext.Context, keystring, dbint) *BoolCmd

func (Tx)ObjectEncoding

func (c Tx) ObjectEncoding(ctxcontext.Context, keystring) *StringCmd

func (Tx)ObjectIdleTime

func (c Tx) ObjectIdleTime(ctxcontext.Context, keystring) *DurationCmd

func (Tx)ObjectRefCount

func (c Tx) ObjectRefCount(ctxcontext.Context, keystring) *IntCmd

func (Tx)PExpire

func (c Tx) PExpire(ctxcontext.Context, keystring, expirationtime.Duration) *BoolCmd

func (Tx)PExpireAt

func (c Tx) PExpireAt(ctxcontext.Context, keystring, tmtime.Time) *BoolCmd

func (Tx)PFAdd

func (c Tx) PFAdd(ctxcontext.Context, keystring, els ...interface{}) *IntCmd

func (Tx)PFCount

func (c Tx) PFCount(ctxcontext.Context, keys ...string) *IntCmd

func (Tx)PFMerge

func (c Tx) PFMerge(ctxcontext.Context, deststring, keys ...string) *StatusCmd

func (Tx)PTTL

func (c Tx) PTTL(ctxcontext.Context, keystring) *DurationCmd

func (Tx)Persist

func (c Tx) Persist(ctxcontext.Context, keystring) *BoolCmd

func (Tx)Ping

func (c Tx) Ping(ctxcontext.Context) *StatusCmd

func (*Tx)Pipeline

func (c *Tx) Pipeline()Pipeliner

Pipeline creates a pipeline. Usually it is more convenient to use Pipelined.

func (*Tx)Pipelined

func (c *Tx) Pipelined(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)

Pipelined executes commands queued in the fn outside of the transaction.Use TxPipelined if you need transactional behavior.

func (*Tx)Process

func (c *Tx) Process(ctxcontext.Context, cmdCmder)error

func (Tx)PubSubChannels

func (c Tx) PubSubChannels(ctxcontext.Context, patternstring) *StringSliceCmd

func (Tx)PubSubNumPat

func (c Tx) PubSubNumPat(ctxcontext.Context) *IntCmd

func (Tx)PubSubNumSub

func (c Tx) PubSubNumSub(ctxcontext.Context, channels ...string) *StringIntMapCmd

func (Tx)Publish

func (c Tx) Publish(ctxcontext.Context, channelstring, message interface{}) *IntCmd

Publish posts the message to the channel.

func (Tx)Quit

func (c Tx) Quit(_context.Context) *StatusCmd

func (Tx)RPop

func (c Tx) RPop(ctxcontext.Context, keystring) *StringCmd

func (Tx)RPopCountadded inv8.11.1

func (c Tx) RPopCount(ctxcontext.Context, keystring, countint) *StringSliceCmd

func (Tx)RPopLPush

func (c Tx) RPopLPush(ctxcontext.Context, source, destinationstring) *StringCmd

func (Tx)RPush

func (c Tx) RPush(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Tx)RPushX

func (c Tx) RPushX(ctxcontext.Context, keystring, values ...interface{}) *IntCmd

func (Tx)RandomKey

func (c Tx) RandomKey(ctxcontext.Context) *StringCmd

func (Tx)ReadOnly

func (c Tx) ReadOnly(ctxcontext.Context) *StatusCmd

func (Tx)ReadWrite

func (c Tx) ReadWrite(ctxcontext.Context) *StatusCmd

func (Tx)Rename

func (c Tx) Rename(ctxcontext.Context, key, newkeystring) *StatusCmd

func (Tx)RenameNX

func (c Tx) RenameNX(ctxcontext.Context, key, newkeystring) *BoolCmd

func (Tx)Restore

func (c Tx) Restore(ctxcontext.Context, keystring, ttltime.Duration, valuestring) *StatusCmd

func (Tx)RestoreReplace

func (c Tx) RestoreReplace(ctxcontext.Context, keystring, ttltime.Duration, valuestring) *StatusCmd

func (Tx)SAdd

func (c Tx) SAdd(ctxcontext.Context, keystring, members ...interface{}) *IntCmd

func (Tx)SCard

func (c Tx) SCard(ctxcontext.Context, keystring) *IntCmd

func (Tx)SDiff

func (c Tx) SDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Tx)SDiffStore

func (c Tx) SDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

func (Tx)SInter

func (c Tx) SInter(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Tx)SInterStore

func (c Tx) SInterStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

func (Tx)SIsMember

func (c Tx) SIsMember(ctxcontext.Context, keystring, member interface{}) *BoolCmd

func (Tx)SMIsMemberadded inv8.8.3

func (c Tx) SMIsMember(ctxcontext.Context, keystring, members ...interface{}) *BoolSliceCmd

SMIsMember Redis `SMISMEMBER key member [member ...]` command.

func (Tx)SMembers

func (c Tx) SMembers(ctxcontext.Context, keystring) *StringSliceCmd

SMembers Redis `SMEMBERS key` command output as a slice.

func (Tx)SMembersMap

func (c Tx) SMembersMap(ctxcontext.Context, keystring) *StringStructMapCmd

SMembersMap Redis `SMEMBERS key` command output as a map.

func (Tx)SMove

func (c Tx) SMove(ctxcontext.Context, source, destinationstring, member interface{}) *BoolCmd

func (Tx)SPop

func (c Tx) SPop(ctxcontext.Context, keystring) *StringCmd

SPop Redis `SPOP key` command.

func (Tx)SPopN

func (c Tx) SPopN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SPopN Redis `SPOP key count` command.

func (Tx)SRandMember

func (c Tx) SRandMember(ctxcontext.Context, keystring) *StringCmd

SRandMember Redis `SRANDMEMBER key` command.

func (Tx)SRandMemberN

func (c Tx) SRandMemberN(ctxcontext.Context, keystring, countint64) *StringSliceCmd

SRandMemberN Redis `SRANDMEMBER key count` command.

func (Tx)SRem

func (c Tx) SRem(ctxcontext.Context, keystring, members ...interface{}) *IntCmd

func (Tx)SScan

func (c Tx) SScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (Tx)SUnion

func (c Tx) SUnion(ctxcontext.Context, keys ...string) *StringSliceCmd

func (Tx)SUnionStore

func (c Tx) SUnionStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

func (Tx)Save

func (c Tx) Save(ctxcontext.Context) *StatusCmd

func (Tx)Scan

func (c Tx) Scan(ctxcontext.Context, cursoruint64, matchstring, countint64) *ScanCmd

func (Tx)ScanTypeadded inv8.4.7

func (c Tx) ScanType(ctxcontext.Context, cursoruint64, matchstring, countint64, keyTypestring) *ScanCmd

func (Tx)ScriptExists

func (c Tx) ScriptExists(ctxcontext.Context, hashes ...string) *BoolSliceCmd

func (Tx)ScriptFlush

func (c Tx) ScriptFlush(ctxcontext.Context) *StatusCmd

func (Tx)ScriptKill

func (c Tx) ScriptKill(ctxcontext.Context) *StatusCmd

func (Tx)ScriptLoad

func (c Tx) ScriptLoad(ctxcontext.Context, scriptstring) *StringCmd

func (Tx)Select

func (c Tx) Select(ctxcontext.Context, indexint) *StatusCmd

func (Tx)Set

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

Set Redis `SET key value [expiration]` command.Use expiration for `SETEX`-like behavior.

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Tx)SetArgsadded inv8.6.0

func (c Tx) SetArgs(ctxcontext.Context, keystring, value interface{}, aSetArgs) *StatusCmd

SetArgs supports all the options that the SET command supports.It is the alternative to the Set function when you wantto have more control over the options.

func (Tx)SetBit

func (c Tx) SetBit(ctxcontext.Context, keystring, offsetint64, valueint) *IntCmd

func (Tx)SetEXadded inv8.3.3

func (c Tx) SetEX(ctxcontext.Context, keystring, value interface{}, expirationtime.Duration) *StatusCmd

SetEX Redis `SETEX key expiration value` command.

func (Tx)SetNX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Tx)SetRange

func (c Tx) SetRange(ctxcontext.Context, keystring, offsetint64, valuestring) *IntCmd

func (Tx)SetXX

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

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

Zero expiration means the key has no expiration time.KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,otherwise you will receive an error: (error) ERR syntax error.

func (Tx)Shutdown

func (c Tx) Shutdown(ctxcontext.Context) *StatusCmd

func (Tx)ShutdownNoSave

func (c Tx) ShutdownNoSave(ctxcontext.Context) *StatusCmd

func (Tx)ShutdownSave

func (c Tx) ShutdownSave(ctxcontext.Context) *StatusCmd

func (Tx)SlaveOf

func (c Tx) SlaveOf(ctxcontext.Context, host, portstring) *StatusCmd

func (Tx)SlowLogGet

func (c Tx) SlowLogGet(ctxcontext.Context, numint64) *SlowLogCmd

func (Tx)Sort

func (c Tx) Sort(ctxcontext.Context, keystring, sort *Sort) *StringSliceCmd

func (Tx)SortInterfaces

func (c Tx) SortInterfaces(ctxcontext.Context, keystring, sort *Sort) *SliceCmd

func (Tx)SortStore

func (c Tx) SortStore(ctxcontext.Context, key, storestring, sort *Sort) *IntCmd

func (Tx)StrLen

func (c Tx) StrLen(ctxcontext.Context, keystring) *IntCmd

func (*Tx)String

func (c *Tx) String()string

func (Tx)SwapDB

func (c Tx) SwapDB(ctxcontext.Context, index1, index2int) *StatusCmd

func (Tx)Sync

func (c Tx) Sync(_context.Context)

func (Tx)TTL

func (c Tx) TTL(ctxcontext.Context, keystring) *DurationCmd

func (Tx)Time

func (c Tx) Time(ctxcontext.Context) *TimeCmd

func (Tx)Touch

func (c Tx) Touch(ctxcontext.Context, keys ...string) *IntCmd

func (*Tx)TxPipeline

func (c *Tx) TxPipeline()Pipeliner

TxPipeline creates a pipeline. Usually it is more convenient to use TxPipelined.

func (*Tx)TxPipelined

func (c *Tx) TxPipelined(ctxcontext.Context, fn func(Pipeliner)error) ([]Cmder,error)

TxPipelined executes commands queued in the fn in the 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)Type

func (c Tx) Type(ctxcontext.Context, keystring) *StatusCmd

func (Tx)Unlink

func (c Tx) Unlink(ctxcontext.Context, keys ...string) *IntCmd

func (*Tx)Unwatch

func (c *Tx) Unwatch(ctxcontext.Context, keys ...string) *StatusCmd

Unwatch flushes all the previously watched keys for a transaction.

func (Tx)Wait

func (c Tx) Wait(ctxcontext.Context, numSlavesint, timeouttime.Duration) *IntCmd

func (*Tx)Watch

func (c *Tx) Watch(ctxcontext.Context, keys ...string) *StatusCmd

Watch marks the keys to be watched for conditional executionof a transaction.

func (*Tx)WithContext

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

func (Tx)XAck

func (c Tx) XAck(ctxcontext.Context, stream, groupstring, ids ...string) *IntCmd

func (Tx)XAdd

func (c Tx) XAdd(ctxcontext.Context, a *XAddArgs) *StringCmd

XAdd a.Limit has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046

func (Tx)XAutoClaimadded inv8.11.0

func (c Tx) XAutoClaim(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimCmd

func (Tx)XAutoClaimJustIDadded inv8.11.0

func (c Tx) XAutoClaimJustID(ctxcontext.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd

func (Tx)XClaim

func (c Tx) XClaim(ctxcontext.Context, a *XClaimArgs) *XMessageSliceCmd

func (Tx)XClaimJustID

func (c Tx) XClaimJustID(ctxcontext.Context, a *XClaimArgs) *StringSliceCmd

func (Tx)XDel

func (c Tx) XDel(ctxcontext.Context, streamstring, ids ...string) *IntCmd

func (Tx)XGroupCreate

func (c Tx) XGroupCreate(ctxcontext.Context, stream, group, startstring) *StatusCmd

func (Tx)XGroupCreateConsumeradded inv8.11.0

func (c Tx) XGroupCreateConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmd

func (Tx)XGroupCreateMkStream

func (c Tx) XGroupCreateMkStream(ctxcontext.Context, stream, group, startstring) *StatusCmd

func (Tx)XGroupDelConsumer

func (c Tx) XGroupDelConsumer(ctxcontext.Context, stream, group, consumerstring) *IntCmd

func (Tx)XGroupDestroy

func (c Tx) XGroupDestroy(ctxcontext.Context, stream, groupstring) *IntCmd

func (Tx)XGroupSetID

func (c Tx) XGroupSetID(ctxcontext.Context, stream, group, startstring) *StatusCmd

func (Tx)XInfoConsumersadded inv8.6.0

func (c Tx) XInfoConsumers(ctxcontext.Context, keystring, groupstring) *XInfoConsumersCmd

func (Tx)XInfoGroups

func (c Tx) XInfoGroups(ctxcontext.Context, keystring) *XInfoGroupsCmd

func (Tx)XInfoStreamadded inv8.2.1

func (c Tx) XInfoStream(ctxcontext.Context, keystring) *XInfoStreamCmd

func (Tx)XInfoStreamFulladded inv8.9.0

func (c Tx) XInfoStreamFull(ctxcontext.Context, keystring, countint) *XInfoStreamFullCmd

XInfoStreamFull XINFO STREAM FULL [COUNT count]redis-server >= 6.0.

func (Tx)XLen

func (c Tx) XLen(ctxcontext.Context, streamstring) *IntCmd

func (Tx)XPending

func (c Tx) XPending(ctxcontext.Context, stream, groupstring) *XPendingCmd

func (Tx)XPendingExt

func (c Tx) XPendingExt(ctxcontext.Context, a *XPendingExtArgs) *XPendingExtCmd

func (Tx)XRange

func (c Tx) XRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmd

func (Tx)XRangeN

func (c Tx) XRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmd

func (Tx)XRead

func (c Tx) XRead(ctxcontext.Context, a *XReadArgs) *XStreamSliceCmd

func (Tx)XReadGroup

func (c Tx) XReadGroup(ctxcontext.Context, a *XReadGroupArgs) *XStreamSliceCmd

func (Tx)XReadStreams

func (c Tx) XReadStreams(ctxcontext.Context, streams ...string) *XStreamSliceCmd

func (Tx)XRevRange

func (c Tx) XRevRange(ctxcontext.Context, stream, start, stopstring) *XMessageSliceCmd

func (Tx)XRevRangeN

func (c Tx) XRevRangeN(ctxcontext.Context, stream, start, stopstring, countint64) *XMessageSliceCmd

func (Tx)XTrimdeprecated

func (c Tx) XTrim(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLen, remove in v9.

func (Tx)XTrimApproxdeprecated

func (c Tx) XTrimApprox(ctxcontext.Context, keystring, maxLenint64) *IntCmd

Deprecated: use XTrimMaxLenApprox, remove in v9.

func (Tx)XTrimMaxLenadded inv8.11.0

func (c Tx) XTrimMaxLen(ctxcontext.Context, keystring, maxLenint64) *IntCmd

XTrimMaxLen No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MAXLEN maxLen

func (Tx)XTrimMaxLenApproxadded inv8.11.0

func (c Tx) XTrimMaxLenApprox(ctxcontext.Context, keystring, maxLen, limitint64) *IntCmd

XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit

func (Tx)XTrimMinIDadded inv8.11.0

func (c Tx) XTrimMinID(ctxcontext.Context, keystring, minIDstring) *IntCmd

XTrimMinID No `~` rules are used, `limit` cannot be used.cmd: XTRIM key MINID minID

func (Tx)XTrimMinIDApproxadded inv8.11.0

func (c Tx) XTrimMinIDApprox(ctxcontext.Context, keystring, minIDstring, limitint64) *IntCmd

XTrimMinIDApprox LIMIT has a bug, please confirm it and use it.issue:https://github.com/redis/redis/issues/9046cmd: XTRIM key MINID ~ minID LIMIT limit

func (Tx)ZAdd

func (c Tx) ZAdd(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Tx)ZAddArgsadded inv8.11.0

func (c Tx) ZAddArgs(ctxcontext.Context, keystring, argsZAddArgs) *IntCmd

func (Tx)ZAddArgsIncradded inv8.11.0

func (c Tx) ZAddArgsIncr(ctxcontext.Context, keystring, argsZAddArgs) *FloatCmd

func (Tx)ZAddCh

func (c Tx) ZAddCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddCh Redis `ZADD key CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{Ch: true,Members: []Z,})remove in v9.

func (Tx)ZAddNX

func (c Tx) ZAddNX(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Tx)ZAddNXCh

func (c Tx) ZAddNXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{NX: true,Ch: true,Members: []Z,})remove in v9.

func (Tx)ZAddXX

func (c Tx) ZAddXX(ctxcontext.Context, keystring, members ...*Z) *IntCmd

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

func (Tx)ZAddXXCh

func (c Tx) ZAddXXCh(ctxcontext.Context, keystring, members ...*Z) *IntCmd

ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.Deprecated: Use

client.ZAddArgs(ctx, ZAddArgs{XX: true,Ch: true,Members: []Z,})remove in v9.

func (Tx)ZCard

func (c Tx) ZCard(ctxcontext.Context, keystring) *IntCmd

func (Tx)ZCount

func (c Tx) ZCount(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Tx)ZDiffadded inv8.9.0

func (c Tx) ZDiff(ctxcontext.Context, keys ...string) *StringSliceCmd

ZDiff redis-server version >= 6.2.0.

func (Tx)ZDiffStoreadded inv8.10.0

func (c Tx) ZDiffStore(ctxcontext.Context, destinationstring, keys ...string) *IntCmd

ZDiffStore redis-server version >=6.2.0.

func (Tx)ZDiffWithScoresadded inv8.9.0

func (c Tx) ZDiffWithScores(ctxcontext.Context, keys ...string) *ZSliceCmd

ZDiffWithScores redis-server version >= 6.2.0.

func (Tx)ZIncr

func (c Tx) ZIncr(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncr Redis `ZADD key INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{Members: []Z,})remove in v9.

func (Tx)ZIncrBy

func (c Tx) ZIncrBy(ctxcontext.Context, keystring, incrementfloat64, memberstring) *FloatCmd

func (Tx)ZIncrNX

func (c Tx) ZIncrNX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrNX Redis `ZADD key NX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{NX: true,Members: []Z,})remove in v9.

func (Tx)ZIncrXX

func (c Tx) ZIncrXX(ctxcontext.Context, keystring, member *Z) *FloatCmd

ZIncrXX Redis `ZADD key XX INCR score member` command.Deprecated: Use

client.ZAddArgsIncr(ctx, ZAddArgs{XX: true,Members: []Z,})remove in v9.

func (Tx)ZInteradded inv8.10.0

func (c Tx) ZInter(ctxcontext.Context, store *ZStore) *StringSliceCmd

func (Tx)ZInterStore

func (c Tx) ZInterStore(ctxcontext.Context, destinationstring, store *ZStore) *IntCmd

func (Tx)ZInterWithScoresadded inv8.10.0

func (c Tx) ZInterWithScores(ctxcontext.Context, store *ZStore) *ZSliceCmd

func (Tx)ZLexCount

func (c Tx) ZLexCount(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Tx)ZMScoreadded inv8.8.0

func (c Tx) ZMScore(ctxcontext.Context, keystring, members ...string) *FloatSliceCmd

func (Tx)ZPopMax

func (c Tx) ZPopMax(ctxcontext.Context, keystring, count ...int64) *ZSliceCmd

func (Tx)ZPopMin

func (c Tx) ZPopMin(ctxcontext.Context, keystring, count ...int64) *ZSliceCmd

func (Tx)ZRandMemberadded inv8.8.1

func (c Tx) ZRandMember(ctxcontext.Context, keystring, countint, withScoresbool) *StringSliceCmd

ZRandMember redis-server version >= 6.2.0.

func (Tx)ZRange

func (c Tx) ZRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Tx)ZRangeArgsadded inv8.11.0

func (c Tx) ZRangeArgs(ctxcontext.Context, zZRangeArgs) *StringSliceCmd

func (Tx)ZRangeArgsWithScoresadded inv8.11.0

func (c Tx) ZRangeArgsWithScores(ctxcontext.Context, zZRangeArgs) *ZSliceCmd

func (Tx)ZRangeByLex

func (c Tx) ZRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Tx)ZRangeByScore

func (c Tx) ZRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Tx)ZRangeByScoreWithScores

func (c Tx) ZRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Tx)ZRangeStoreadded inv8.11.0

func (c Tx) ZRangeStore(ctxcontext.Context, dststring, zZRangeArgs) *IntCmd

func (Tx)ZRangeWithScores

func (c Tx) ZRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmd

func (Tx)ZRank

func (c Tx) ZRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Tx)ZRem

func (c Tx) ZRem(ctxcontext.Context, keystring, members ...interface{}) *IntCmd

func (Tx)ZRemRangeByLex

func (c Tx) ZRemRangeByLex(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Tx)ZRemRangeByRank

func (c Tx) ZRemRangeByRank(ctxcontext.Context, keystring, start, stopint64) *IntCmd

func (Tx)ZRemRangeByScore

func (c Tx) ZRemRangeByScore(ctxcontext.Context, key, min, maxstring) *IntCmd

func (Tx)ZRevRange

func (c Tx) ZRevRange(ctxcontext.Context, keystring, start, stopint64) *StringSliceCmd

func (Tx)ZRevRangeByLex

func (c Tx) ZRevRangeByLex(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Tx)ZRevRangeByScore

func (c Tx) ZRevRangeByScore(ctxcontext.Context, keystring, opt *ZRangeBy) *StringSliceCmd

func (Tx)ZRevRangeByScoreWithScores

func (c Tx) ZRevRangeByScoreWithScores(ctxcontext.Context, keystring, opt *ZRangeBy) *ZSliceCmd

func (Tx)ZRevRangeWithScores

func (c Tx) ZRevRangeWithScores(ctxcontext.Context, keystring, start, stopint64) *ZSliceCmd

func (Tx)ZRevRank

func (c Tx) ZRevRank(ctxcontext.Context, key, memberstring) *IntCmd

func (Tx)ZScan

func (c Tx) ZScan(ctxcontext.Context, keystring, cursoruint64, matchstring, countint64) *ScanCmd

func (Tx)ZScore

func (c Tx) ZScore(ctxcontext.Context, key, memberstring) *FloatCmd

func (Tx)ZUnionadded inv8.11.0

func (c Tx) ZUnion(ctxcontext.Context, storeZStore) *StringSliceCmd

func (Tx)ZUnionStore

func (c Tx) ZUnionStore(ctxcontext.Context, deststring, store *ZStore) *IntCmd

func (Tx)ZUnionWithScoresadded inv8.11.0

func (c Tx) ZUnionWithScores(ctxcontext.Context, storeZStore) *ZSliceCmd

typeUniversalClient

type UniversalClient interface {CmdableContext()context.ContextAddHook(Hook)Watch(ctxcontext.Context, fn func(*Tx)error, keys ...string)errorDo(ctxcontext.Context, args ...interface{}) *CmdProcess(ctxcontext.Context, cmdCmder)errorSubscribe(ctxcontext.Context, channels ...string) *PubSubPSubscribe(ctxcontext.Context, channels ...string) *PubSubClose()errorPoolStats() *PoolStats}

UniversalClient is an abstract client which - based on the provided options -represents either a ClusterClient, a FailoverClient, or a single-node Client.This can be useful for testing cluster-specific applications locally or having differentclients in different environments.

funcNewUniversalClient

func NewUniversalClient(opts *UniversalOptions)UniversalClient

NewUniversalClient returns a new multi client. The type of the returned client dependson the following conditions:

1. If the MasterName option is specified, a sentinel-backed FailoverClient is returned.2. if the number of Addrs is two or more, a ClusterClient is returned.3. Otherwise, a single-node Client is returned.

Example (Cluster)
rdb := redis.NewUniversalClient(&redis.UniversalOptions{Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},})defer rdb.Close()rdb.Ping(ctx)
Example (Failover)
rdb := redis.NewUniversalClient(&redis.UniversalOptions{MasterName: "master",Addrs:      []string{":26379"},})defer rdb.Close()rdb.Ping(ctx)
Example (Simple)
rdb := redis.NewUniversalClient(&redis.UniversalOptions{Addrs: []string{":6379"},})defer rdb.Close()rdb.Ping(ctx)

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.DBintDialer    func(ctxcontext.Context, network, addrstring) (net.Conn,error)OnConnect func(ctxcontext.Context, cn *Conn)errorUsernamestringPasswordstringSentinelUsernamestringSentinelPasswordstringMaxRetriesintMinRetryBackofftime.DurationMaxRetryBackofftime.DurationDialTimeouttime.DurationReadTimeouttime.DurationWriteTimeouttime.Duration// PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO).PoolFIFOboolPoolSizeintMinIdleConnsintMaxConnAgetime.DurationPoolTimeouttime.DurationIdleTimeouttime.DurationIdleCheckFrequencytime.DurationTLSConfig *tls.ConfigMaxRedirectsintReadOnlyboolRouteByLatencyboolRouteRandomlyboolMasterNamestring}

UniversalOptions information is required by UniversalClient to establishconnections.

func (*UniversalOptions)Cluster

func (o *UniversalOptions) Cluster() *ClusterOptions

Cluster returns cluster options created from the universal options.

func (*UniversalOptions)Failover

func (o *UniversalOptions) Failover() *FailoverOptions

Failover returns failover options created from the universal options.

func (*UniversalOptions)Simple

func (o *UniversalOptions) Simple() *Options

Simple returns basic options created from the universal options.

typeXAddArgs

type XAddArgs struct {StreamstringNoMkStreamboolMaxLenint64// MAXLEN N// Deprecated: use MaxLen+Approx, remove in v9.MaxLenApproxint64// MAXLEN ~ NMinIDstring// Approx causes MaxLen and MinID to use "~" matcher (instead of "=").ApproxboolLimitint64IDstringValues interface{}}

XAddArgs accepts values in the following formats:

  • XAddArgs.Values = []interface{}{"key1", "value1", "key2", "value2"}
  • XAddArgs.Values = []string("key1", "value1", "key2", "value2")
  • XAddArgs.Values = map[string]interface{}{"key1": "value1", "key2": "value2"}

Note that map will not preserve the order of key-value pairs.MaxLen/MaxLenApprox and MinID are in conflict, only one of them can be used.

typeXAutoClaimArgsadded inv8.11.0

type XAutoClaimArgs struct {StreamstringGroupstringMinIdletime.DurationStartstringCountint64Consumerstring}

typeXAutoClaimCmdadded inv8.11.0

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

funcNewXAutoClaimCmdadded inv8.11.0

func NewXAutoClaimCmd(ctxcontext.Context, args ...interface{}) *XAutoClaimCmd

func (*XAutoClaimCmd)Argsadded inv8.11.0

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

func (*XAutoClaimCmd)Erradded inv8.11.0

func (cmd *XAutoClaimCmd) Err()error

func (*XAutoClaimCmd)FullNameadded inv8.11.0

func (cmd *XAutoClaimCmd) FullName()string

func (*XAutoClaimCmd)Nameadded inv8.11.0

func (cmd *XAutoClaimCmd) Name()string

func (*XAutoClaimCmd)Resultadded inv8.11.0

func (cmd *XAutoClaimCmd) Result() (messages []XMessage, startstring, errerror)

func (*XAutoClaimCmd)SetErradded inv8.11.0

func (cmd *XAutoClaimCmd) SetErr(eerror)

func (*XAutoClaimCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XAutoClaimCmd) SetFirstKeyPos(keyPosint8)

func (*XAutoClaimCmd)SetValadded inv8.11.4

func (cmd *XAutoClaimCmd) SetVal(val []XMessage, startstring)

func (*XAutoClaimCmd)Stringadded inv8.11.0

func (cmd *XAutoClaimCmd) String()string

func (*XAutoClaimCmd)Valadded inv8.11.0

func (cmd *XAutoClaimCmd) Val() (messages []XMessage, startstring)

typeXAutoClaimJustIDCmdadded inv8.11.0

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

funcNewXAutoClaimJustIDCmdadded inv8.11.0

func NewXAutoClaimJustIDCmd(ctxcontext.Context, args ...interface{}) *XAutoClaimJustIDCmd

func (*XAutoClaimJustIDCmd)Argsadded inv8.11.0

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

func (*XAutoClaimJustIDCmd)Erradded inv8.11.0

func (cmd *XAutoClaimJustIDCmd) Err()error

func (*XAutoClaimJustIDCmd)FullNameadded inv8.11.0

func (cmd *XAutoClaimJustIDCmd) FullName()string

func (*XAutoClaimJustIDCmd)Nameadded inv8.11.0

func (cmd *XAutoClaimJustIDCmd) Name()string

func (*XAutoClaimJustIDCmd)Resultadded inv8.11.0

func (cmd *XAutoClaimJustIDCmd) Result() (ids []string, startstring, errerror)

func (*XAutoClaimJustIDCmd)SetErradded inv8.11.0

func (cmd *XAutoClaimJustIDCmd) SetErr(eerror)

func (*XAutoClaimJustIDCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XAutoClaimJustIDCmd) SetFirstKeyPos(keyPosint8)

func (*XAutoClaimJustIDCmd)SetValadded inv8.11.4

func (cmd *XAutoClaimJustIDCmd) SetVal(val []string, startstring)

func (*XAutoClaimJustIDCmd)Stringadded inv8.11.0

func (cmd *XAutoClaimJustIDCmd) String()string

func (*XAutoClaimJustIDCmd)Valadded inv8.11.0

func (cmd *XAutoClaimJustIDCmd) Val() (ids []string, startstring)

typeXClaimArgs

type XClaimArgs struct {StreamstringGroupstringConsumerstringMinIdletime.DurationMessages []string}

typeXInfoConsumeradded inv8.6.0

type XInfoConsumer struct {NamestringPendingint64Idleint64}

typeXInfoConsumersCmdadded inv8.6.0

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

funcNewXInfoConsumersCmdadded inv8.6.0

func NewXInfoConsumersCmd(ctxcontext.Context, streamstring, groupstring) *XInfoConsumersCmd

func (*XInfoConsumersCmd)Argsadded inv8.6.0

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

func (*XInfoConsumersCmd)Erradded inv8.6.0

func (cmd *XInfoConsumersCmd) Err()error

func (*XInfoConsumersCmd)FullNameadded inv8.6.0

func (cmd *XInfoConsumersCmd) FullName()string

func (*XInfoConsumersCmd)Nameadded inv8.6.0

func (cmd *XInfoConsumersCmd) Name()string

func (*XInfoConsumersCmd)Resultadded inv8.6.0

func (cmd *XInfoConsumersCmd) Result() ([]XInfoConsumer,error)

func (*XInfoConsumersCmd)SetErradded inv8.6.0

func (cmd *XInfoConsumersCmd) SetErr(eerror)

func (*XInfoConsumersCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XInfoConsumersCmd) SetFirstKeyPos(keyPosint8)

func (*XInfoConsumersCmd)SetValadded inv8.11.4

func (cmd *XInfoConsumersCmd) SetVal(val []XInfoConsumer)

func (*XInfoConsumersCmd)Stringadded inv8.6.0

func (cmd *XInfoConsumersCmd) String()string

func (*XInfoConsumersCmd)Valadded inv8.6.0

func (cmd *XInfoConsumersCmd) Val() []XInfoConsumer

typeXInfoGroupadded inv8.2.0

type XInfoGroup struct {NamestringConsumersint64Pendingint64LastDeliveredIDstring}

typeXInfoGroupsCmd

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

funcNewXInfoGroupsCmd

func NewXInfoGroupsCmd(ctxcontext.Context, streamstring) *XInfoGroupsCmd

func (*XInfoGroupsCmd)Args

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

func (*XInfoGroupsCmd)Err

func (cmd *XInfoGroupsCmd) Err()error

func (*XInfoGroupsCmd)FullName

func (cmd *XInfoGroupsCmd) FullName()string

func (*XInfoGroupsCmd)Name

func (cmd *XInfoGroupsCmd) Name()string

func (*XInfoGroupsCmd)Result

func (cmd *XInfoGroupsCmd) Result() ([]XInfoGroup,error)

func (*XInfoGroupsCmd)SetErr

func (cmd *XInfoGroupsCmd) SetErr(eerror)

func (*XInfoGroupsCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XInfoGroupsCmd) SetFirstKeyPos(keyPosint8)

func (*XInfoGroupsCmd)SetValadded inv8.11.4

func (cmd *XInfoGroupsCmd) SetVal(val []XInfoGroup)

func (*XInfoGroupsCmd)String

func (cmd *XInfoGroupsCmd) String()string

func (*XInfoGroupsCmd)Val

func (cmd *XInfoGroupsCmd) Val() []XInfoGroup

typeXInfoStreamadded inv8.2.1

type XInfoStream struct {Lengthint64RadixTreeKeysint64RadixTreeNodesint64Groupsint64LastGeneratedIDstringFirstEntryXMessageLastEntryXMessage}

typeXInfoStreamCmdadded inv8.2.1

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

funcNewXInfoStreamCmdadded inv8.2.1

func NewXInfoStreamCmd(ctxcontext.Context, streamstring) *XInfoStreamCmd

func (*XInfoStreamCmd)Argsadded inv8.2.1

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

func (*XInfoStreamCmd)Erradded inv8.2.1

func (cmd *XInfoStreamCmd) Err()error

func (*XInfoStreamCmd)FullNameadded inv8.2.1

func (cmd *XInfoStreamCmd) FullName()string

func (*XInfoStreamCmd)Nameadded inv8.2.1

func (cmd *XInfoStreamCmd) Name()string

func (*XInfoStreamCmd)Resultadded inv8.2.1

func (cmd *XInfoStreamCmd) Result() (*XInfoStream,error)

func (*XInfoStreamCmd)SetErradded inv8.2.1

func (cmd *XInfoStreamCmd) SetErr(eerror)

func (*XInfoStreamCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XInfoStreamCmd) SetFirstKeyPos(keyPosint8)

func (*XInfoStreamCmd)SetValadded inv8.11.4

func (cmd *XInfoStreamCmd) SetVal(val *XInfoStream)

func (*XInfoStreamCmd)Stringadded inv8.2.1

func (cmd *XInfoStreamCmd) String()string

func (*XInfoStreamCmd)Valadded inv8.2.1

func (cmd *XInfoStreamCmd) Val() *XInfoStream

typeXInfoStreamConsumeradded inv8.9.0

type XInfoStreamConsumer struct {NamestringSeenTimetime.TimePelCountint64Pending  []XInfoStreamConsumerPending}

typeXInfoStreamConsumerPendingadded inv8.9.0

type XInfoStreamConsumerPending struct {IDstringDeliveryTimetime.TimeDeliveryCountint64}

typeXInfoStreamFulladded inv8.9.0

type XInfoStreamFull struct {Lengthint64RadixTreeKeysint64RadixTreeNodesint64LastGeneratedIDstringEntries         []XMessageGroups          []XInfoStreamGroup}

typeXInfoStreamFullCmdadded inv8.9.0

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

funcNewXInfoStreamFullCmdadded inv8.9.0

func NewXInfoStreamFullCmd(ctxcontext.Context, args ...interface{}) *XInfoStreamFullCmd

func (*XInfoStreamFullCmd)Argsadded inv8.9.0

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

func (*XInfoStreamFullCmd)Erradded inv8.9.0

func (cmd *XInfoStreamFullCmd) Err()error

func (*XInfoStreamFullCmd)FullNameadded inv8.9.0

func (cmd *XInfoStreamFullCmd) FullName()string

func (*XInfoStreamFullCmd)Nameadded inv8.9.0

func (cmd *XInfoStreamFullCmd) Name()string

func (*XInfoStreamFullCmd)Resultadded inv8.9.0

func (cmd *XInfoStreamFullCmd) Result() (*XInfoStreamFull,error)

func (*XInfoStreamFullCmd)SetErradded inv8.9.0

func (cmd *XInfoStreamFullCmd) SetErr(eerror)

func (*XInfoStreamFullCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XInfoStreamFullCmd) SetFirstKeyPos(keyPosint8)

func (*XInfoStreamFullCmd)SetValadded inv8.11.4

func (cmd *XInfoStreamFullCmd) SetVal(val *XInfoStreamFull)

func (*XInfoStreamFullCmd)Stringadded inv8.9.0

func (cmd *XInfoStreamFullCmd) String()string

func (*XInfoStreamFullCmd)Valadded inv8.9.0

typeXInfoStreamGroupadded inv8.9.0

type XInfoStreamGroup struct {NamestringLastDeliveredIDstringPelCountint64Pending         []XInfoStreamGroupPendingConsumers       []XInfoStreamConsumer}

typeXInfoStreamGroupPendingadded inv8.9.0

type XInfoStreamGroupPending struct {IDstringConsumerstringDeliveryTimetime.TimeDeliveryCountint64}

typeXMessage

type XMessage struct {IDstringValues map[string]interface{}}

typeXMessageSliceCmd

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

funcNewXMessageSliceCmd

func NewXMessageSliceCmd(ctxcontext.Context, args ...interface{}) *XMessageSliceCmd

funcNewXMessageSliceCmdResult

func NewXMessageSliceCmdResult(val []XMessage, errerror) *XMessageSliceCmd

NewXMessageSliceCmdResult returns a XMessageSliceCmd initialised with val and err for testing.

func (*XMessageSliceCmd)Args

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

func (*XMessageSliceCmd)Err

func (cmd *XMessageSliceCmd) Err()error

func (*XMessageSliceCmd)FullName

func (cmd *XMessageSliceCmd) FullName()string

func (*XMessageSliceCmd)Name

func (cmd *XMessageSliceCmd) Name()string

func (*XMessageSliceCmd)Result

func (cmd *XMessageSliceCmd) Result() ([]XMessage,error)

func (*XMessageSliceCmd)SetErr

func (cmd *XMessageSliceCmd) SetErr(eerror)

func (*XMessageSliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XMessageSliceCmd) SetFirstKeyPos(keyPosint8)

func (*XMessageSliceCmd)SetValadded inv8.11.4

func (cmd *XMessageSliceCmd) SetVal(val []XMessage)

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(ctxcontext.Context, args ...interface{}) *XPendingCmd

func (*XPendingCmd)Args

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

func (*XPendingCmd)Err

func (cmd *XPendingCmd) Err()error

func (*XPendingCmd)FullName

func (cmd *XPendingCmd) FullName()string

func (*XPendingCmd)Name

func (cmd *XPendingCmd) Name()string

func (*XPendingCmd)Result

func (cmd *XPendingCmd) Result() (*XPending,error)

func (*XPendingCmd)SetErr

func (cmd *XPendingCmd) SetErr(eerror)

func (*XPendingCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XPendingCmd) SetFirstKeyPos(keyPosint8)

func (*XPendingCmd)SetValadded inv8.11.4

func (cmd *XPendingCmd) SetVal(val *XPending)

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 {StreamstringGroupstringIdletime.DurationStartstringEndstringCountint64Consumerstring}

typeXPendingExtCmd

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

funcNewXPendingExtCmd

func NewXPendingExtCmd(ctxcontext.Context, args ...interface{}) *XPendingExtCmd

func (*XPendingExtCmd)Args

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

func (*XPendingExtCmd)Err

func (cmd *XPendingExtCmd) Err()error

func (*XPendingExtCmd)FullName

func (cmd *XPendingExtCmd) FullName()string

func (*XPendingExtCmd)Name

func (cmd *XPendingExtCmd) Name()string

func (*XPendingExtCmd)Result

func (cmd *XPendingExtCmd) Result() ([]XPendingExt,error)

func (*XPendingExtCmd)SetErr

func (cmd *XPendingExtCmd) SetErr(eerror)

func (*XPendingExtCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XPendingExtCmd) SetFirstKeyPos(keyPosint8)

func (*XPendingExtCmd)SetValadded inv8.11.4

func (cmd *XPendingExtCmd) SetVal(val []XPendingExt)

func (*XPendingExtCmd)String

func (cmd *XPendingExtCmd) String()string

func (*XPendingExtCmd)Val

func (cmd *XPendingExtCmd) Val() []XPendingExt

typeXReadArgs

type XReadArgs struct {Streams []string// list of streams and ids, e.g. stream1 stream2 id1 id2Countint64Blocktime.Duration}

typeXReadGroupArgs

type XReadGroupArgs struct {GroupstringConsumerstringStreams  []string// list of streams and ids, e.g. stream1 stream2 id1 id2Countint64Blocktime.DurationNoAckbool}

typeXStream

type XStream struct {StreamstringMessages []XMessage}

typeXStreamSliceCmd

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

funcNewXStreamSliceCmd

func NewXStreamSliceCmd(ctxcontext.Context, args ...interface{}) *XStreamSliceCmd

funcNewXStreamSliceCmdResult

func NewXStreamSliceCmdResult(val []XStream, errerror) *XStreamSliceCmd

NewXStreamSliceCmdResult returns a XStreamSliceCmd initialised with val and err for testing.

func (*XStreamSliceCmd)Args

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

func (*XStreamSliceCmd)Err

func (cmd *XStreamSliceCmd) Err()error

func (*XStreamSliceCmd)FullName

func (cmd *XStreamSliceCmd) FullName()string

func (*XStreamSliceCmd)Name

func (cmd *XStreamSliceCmd) Name()string

func (*XStreamSliceCmd)Result

func (cmd *XStreamSliceCmd) Result() ([]XStream,error)

func (*XStreamSliceCmd)SetErr

func (cmd *XStreamSliceCmd) SetErr(eerror)

func (*XStreamSliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *XStreamSliceCmd) SetFirstKeyPos(keyPosint8)

func (*XStreamSliceCmd)SetValadded inv8.11.4

func (cmd *XStreamSliceCmd) SetVal(val []XStream)

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.

typeZAddArgsadded inv8.11.0

type ZAddArgs struct {NXboolXXboolLTboolGTboolChboolMembers []Z}

ZAddArgs WARN: The GT, LT and NX options are mutually exclusive.

typeZRangeArgsadded inv8.11.0

type ZRangeArgs struct {Keystring// When the ByScore option is provided, the open interval(exclusive) can be set.// By default, the score intervals specified by <Start> and <Stop> are closed (inclusive).// It is similar to the deprecated(6.2.0+) ZRangeByScore command.// For example://ZRangeArgs{//Key: "example-key",// Start: "(3",// Stop: 8,//ByScore:true,// }//  cmd: "ZRange example-key (3 8 ByScore"  (3 < score <= 8).//// For the ByLex option, it is similar to the deprecated(6.2.0+) ZRangeByLex command.// You can set the <Start> and <Stop> options as follows://ZRangeArgs{//Key: "example-key",// Start: "[abc",// Stop: "(def",//ByLex:true,// }//cmd: "ZRange example-key [abc (def ByLex"//// For normal cases (ByScore==false && ByLex==false), <Start> and <Stop> should be set to the index range (int).// You can read the documentation for more information:https://redis.io/commands/zrangeStart interface{}Stop  interface{}// The ByScore and ByLex options are mutually exclusive.ByScoreboolByLexboolRevbool// limit offset count.Offsetint64Countint64}

ZRangeArgs is all the options of the ZRange command.In version> 6.2.0, you can replace the(cmd):

ZREVRANGE,ZRANGEBYSCORE,ZREVRANGEBYSCORE,ZRANGEBYLEX,ZREVRANGEBYLEX.

Please pay attention to your redis-server version.

Rev, ByScore, ByLex and Offset+Count options require redis-server 6.2.0 and higher.

typeZRangeBy

type ZRangeBy struct {Min, MaxstringOffset, Countint64}

typeZSliceCmd

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

funcNewZSliceCmd

func NewZSliceCmd(ctxcontext.Context, 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)FullName

func (cmd *ZSliceCmd) FullName()string

func (*ZSliceCmd)Name

func (cmd *ZSliceCmd) Name()string

func (*ZSliceCmd)Result

func (cmd *ZSliceCmd) Result() ([]Z,error)

func (*ZSliceCmd)SetErr

func (cmd *ZSliceCmd) SetErr(eerror)

func (*ZSliceCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *ZSliceCmd) SetFirstKeyPos(keyPosint8)

func (*ZSliceCmd)SetValadded inv8.11.4

func (cmd *ZSliceCmd) SetVal(val []Z)

func (*ZSliceCmd)String

func (cmd *ZSliceCmd) String()string

func (*ZSliceCmd)Val

func (cmd *ZSliceCmd) Val() []Z

typeZStore

type ZStore struct {Keys    []stringWeights []float64// Can be SUM, MIN or MAX.Aggregatestring}

ZStore is used as an arg to ZInter/ZInterStore and ZUnion/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(ctxcontext.Context, args ...interface{}) *ZWithKeyCmd

funcNewZWithKeyCmdResult

func NewZWithKeyCmdResult(val *ZWithKey, errerror) *ZWithKeyCmd

NewZWithKeyCmdResult returns a NewZWithKeyCmd initialised with val and err for testing.

func (*ZWithKeyCmd)Args

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

func (*ZWithKeyCmd)Err

func (cmd *ZWithKeyCmd) Err()error

func (*ZWithKeyCmd)FullName

func (cmd *ZWithKeyCmd) FullName()string

func (*ZWithKeyCmd)Name

func (cmd *ZWithKeyCmd) Name()string

func (*ZWithKeyCmd)Result

func (cmd *ZWithKeyCmd) Result() (*ZWithKey,error)

func (*ZWithKeyCmd)SetErr

func (cmd *ZWithKeyCmd) SetErr(eerror)

func (*ZWithKeyCmd)SetFirstKeyPosadded inv8.11.5

func (cmd *ZWithKeyCmd) SetFirstKeyPos(keyPosint8)

func (*ZWithKeyCmd)SetValadded inv8.11.4

func (cmd *ZWithKeyCmd) SetVal(val *ZWithKey)

func (*ZWithKeyCmd)String

func (cmd *ZWithKeyCmd) String()string

func (*ZWithKeyCmd)Val

func (cmd *ZWithKeyCmd) Val() *ZWithKey

Source Files

View all Source files

Directories

PathSynopsis

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