redis

package module
v3.6.4 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2016 License: BSD-2-Clause Imports: 21 Imported by: 724

README

Redis client for Golang Build Status

Supports:

API docs: http://godoc.org/gopkg.in/redis.v3. Examples: http://godoc.org/gopkg.in/redis.v3#pkg-examples.

Installation

Install:

go get gopkg.in/redis.v3

Quickstart

func ExampleNewClient() {
	client := redis.NewClient(&redis.Options{
		Addr:     "localhost:6379",
		Password: "", // no password set
		DB:       0,  // use default DB
	})

	pong, err := client.Ping().Result()
	fmt.Println(pong, err)
	// Output: PONG <nil>
}

func ExampleClient() {
	err := client.Set("key", "value", 0).Err()
	if err != nil {
		panic(err)
	}

	val, err := client.Get("key").Result()
	if err != nil {
		panic(err)
	}
	fmt.Println("key", val)

	val2, err := client.Get("key2").Result()
	if err == redis.Nil {
		fmt.Println("key2 does not exists")
	} else if err != nil {
		panic(err)
	} else {
		fmt.Println("key2", val2)
	}
	// Output: key value
	// key2 does not exists
}

Howto

Please go through examples to get an idea how to use this package.

Look and feel

Some corner cases:

SET key value EX 10 NX
set, err := client.SetNX("key", "value", 10*time.Second).Result()

SORT list LIMIT 0 2 ASC
vals, err := client.Sort("list", redis.Sort{Offset: 0, Count: 2, Order: "ASC"}).Result()

ZRANGEBYSCORE zset -inf +inf WITHSCORES LIMIT 0 2
vals, err := client.ZRangeByScoreWithScores("zset", redis.ZRangeByScore{
    Min: "-inf",
    Max: "+inf",
    Offset: 0,
    Count: 2,
}).Result()

ZINTERSTORE out 2 zset1 zset2 WEIGHTS 2 3 AGGREGATE SUM
vals, err := client.ZInterStore("out", redis.ZStore{Weights: []int64{2, 3}}, "zset1", "zset2").Result()

EVAL "return {KEYS[1],ARGV[1]}" 1 "key" "hello"
vals, err := client.Eval("return {KEYS[1],ARGV[1]}", []string{"key"}, []string{"hello"}).Result()

Benchmark

go-redis vs redigo:

BenchmarkSetGoRedis10Conns64Bytes-4 	  200000	      7621 ns/op	     210 B/op	       6 allocs/op
BenchmarkSetGoRedis100Conns64Bytes-4	  200000	      7554 ns/op	     210 B/op	       6 allocs/op
BenchmarkSetGoRedis10Conns1KB-4     	  200000	      7697 ns/op	     210 B/op	       6 allocs/op
BenchmarkSetGoRedis100Conns1KB-4    	  200000	      7688 ns/op	     210 B/op	       6 allocs/op
BenchmarkSetGoRedis10Conns10KB-4    	  200000	      9214 ns/op	     210 B/op	       6 allocs/op
BenchmarkSetGoRedis100Conns10KB-4   	  200000	      9181 ns/op	     210 B/op	       6 allocs/op
BenchmarkSetGoRedis10Conns1MB-4     	    2000	    583242 ns/op	    2337 B/op	       6 allocs/op
BenchmarkSetGoRedis100Conns1MB-4    	    2000	    583089 ns/op	    2338 B/op	       6 allocs/op
BenchmarkSetRedigo10Conns64Bytes-4  	  200000	      7576 ns/op	     208 B/op	       7 allocs/op
BenchmarkSetRedigo100Conns64Bytes-4 	  200000	      7782 ns/op	     208 B/op	       7 allocs/op
BenchmarkSetRedigo10Conns1KB-4      	  200000	      7958 ns/op	     208 B/op	       7 allocs/op
BenchmarkSetRedigo100Conns1KB-4     	  200000	      7725 ns/op	     208 B/op	       7 allocs/op
BenchmarkSetRedigo10Conns10KB-4     	  100000	     18442 ns/op	     208 B/op	       7 allocs/op
BenchmarkSetRedigo100Conns10KB-4    	  100000	     18818 ns/op	     208 B/op	       7 allocs/op
BenchmarkSetRedigo10Conns1MB-4      	    2000	    668829 ns/op	     226 B/op	       7 allocs/op
BenchmarkSetRedigo100Conns1MB-4     	    2000	    679542 ns/op	     226 B/op	       7 allocs/op

Redis Cluster:

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

Shameless plug

Check my PostgreSQL client for Go.

Documentation

Overview

Package redis implements a Redis client.

Example (CustomCommand)
Get := func(client *redis.Client, key string) *redis.StringCmd {
	cmd := redis.NewStringCmd("GET", key)
	client.Process(cmd)
	return cmd
}

v, err := Get(client, "key_does_not_exist").Result()
fmt.Printf("%q %s", v, err)
Output:

"" redis: nil

Index

Examples

Constants

This section is empty.

Variables

View Source
var Logger *log.Logger
View Source
var Nil = errorf("redis: nil")

Redis nil reply, .e.g. when key does not exist.

View Source
var TxFailedErr = errorf("redis: transaction failed")

Redis transaction failed.

Functions

func SetLogger added in v3.5.0

func SetLogger(logger *log.Logger)

Types

type BitCount

type BitCount struct {
	Start, End int64
}

type BoolCmd

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

func NewBoolCmd

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

func (*BoolCmd) Err

func (cmd *BoolCmd) Err() error

func (*BoolCmd) Result

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

func (*BoolCmd) String

func (cmd *BoolCmd) String() string

func (*BoolCmd) Val

func (cmd *BoolCmd) Val() bool

type BoolSliceCmd

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

func NewBoolSliceCmd

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

func (*BoolSliceCmd) Err

func (cmd *BoolSliceCmd) Err() error

func (*BoolSliceCmd) Result

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

func (*BoolSliceCmd) String

func (cmd *BoolSliceCmd) String() string

func (*BoolSliceCmd) Val

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

type Client

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

Client is a Redis client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.

Example
err := client.Set("key", "value", 0).Err()
if err != nil {
	panic(err)
}

val, err := client.Get("key").Result()
if err != nil {
	panic(err)
}
fmt.Println("key", val)

val2, err := client.Get("key2").Result()
if err == redis.Nil {
	fmt.Println("key2 does not exists")
} else if err != nil {
	panic(err)
} else {
	fmt.Println("key2", val2)
}
Output:

key value
key2 does not exists

func NewClient

func NewClient(opt *Options) *Client

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

Example
client := redis.NewClient(&redis.Options{
	Addr:     "localhost:6379",
	Password: "", // no password set
	DB:       0,  // use default DB
})

pong, err := client.Ping().Result()
fmt.Println(pong, err)
Output:

PONG <nil>

func NewFailoverClient

func NewFailoverClient(failoverOpt *FailoverOptions) *Client

NewFailoverClient returns a Redis client that uses Redis Sentinel for automatic failover. It's safe for concurrent use by multiple goroutines.

Example
// See http://redis.io/topics/sentinel for instructions how to
// setup Redis Sentinel.
client := redis.NewFailoverClient(&redis.FailoverOptions{
	MasterName:    "master",
	SentinelAddrs: []string{":26379"},
})
client.Ping()
Output:

func (*Client) Append

func (c *Client) Append(key, value string) *IntCmd

func (*Client) Auth

func (c *Client) Auth(password string) *StatusCmd

func (*Client) BLPop

func (c *Client) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd
Example
if err := client.RPush("queue", "message").Err(); err != nil {
	panic(err)
}

// use `client.BLPop(0, "queue")` for infinite waiting time
result, err := client.BLPop(1*time.Second, "queue").Result()
if err != nil {
	panic(err)
}

fmt.Println(result[0], result[1])
Output:

queue message

func (*Client) BRPop

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

func (*Client) BRPopLPush

func (c *Client) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Client) BgRewriteAOF

func (c *Client) BgRewriteAOF() *StatusCmd

func (*Client) BgSave

func (c *Client) BgSave() *StatusCmd

func (*Client) BitCount

func (c *Client) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Client) BitOpAnd

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

func (*Client) BitOpNot

func (c *Client) BitOpNot(destKey string, key string) *IntCmd

func (*Client) BitOpOr

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

func (*Client) BitOpXor

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

func (*Client) BitPos

func (c *Client) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Client) ClientGetName added in v3.2.13

func (c *Client) ClientGetName() *StringCmd

ClientGetName returns the name of the one of many connections in the pool.

func (*Client) ClientKill

func (c *Client) ClientKill(ipPort string) *StatusCmd

func (*Client) ClientList

func (c *Client) ClientList() *StringCmd

func (*Client) ClientPause

func (c *Client) ClientPause(dur time.Duration) *BoolCmd

func (*Client) ClientSetName added in v3.2.13

func (c *Client) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the one of many connections in the pool.

func (*Client) Close

func (c *Client) Close() error

Close closes the client, releasing any open resources.

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

func (*Client) ClusterAddSlots

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

func (*Client) ClusterAddSlotsRange

func (c *Client) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Client) ClusterCountFailureReports added in v3.2.26

func (c *Client) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Client) ClusterCountKeysInSlot added in v3.2.26

func (c *Client) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Client) ClusterDelSlots added in v3.2.26

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

func (*Client) ClusterDelSlotsRange added in v3.2.26

func (c *Client) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Client) ClusterFailover

func (c *Client) ClusterFailover() *StatusCmd

func (*Client) ClusterForget added in v3.2.20

func (c *Client) ClusterForget(nodeID string) *StatusCmd

func (*Client) ClusterInfo

func (c *Client) ClusterInfo() *StringCmd

func (*Client) ClusterKeySlot added in v3.2.26

func (c *Client) ClusterKeySlot(key string) *IntCmd

func (*Client) ClusterMeet

func (c *Client) ClusterMeet(host, port string) *StatusCmd

func (*Client) ClusterNodes

func (c *Client) ClusterNodes() *StringCmd

func (*Client) ClusterReplicate

func (c *Client) ClusterReplicate(nodeID string) *StatusCmd

func (*Client) ClusterResetHard added in v3.2.24

func (c *Client) ClusterResetHard() *StatusCmd

func (*Client) ClusterResetSoft added in v3.2.24

func (c *Client) ClusterResetSoft() *StatusCmd

func (*Client) ClusterSaveConfig added in v3.2.26

func (c *Client) ClusterSaveConfig() *StatusCmd

func (*Client) ClusterSlaves added in v3.2.26

func (c *Client) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Client) ClusterSlots

func (c *Client) ClusterSlots() *ClusterSlotCmd

func (*Client) ConfigGet

func (c *Client) ConfigGet(parameter string) *SliceCmd

func (*Client) ConfigResetStat

func (c *Client) ConfigResetStat() *StatusCmd

func (*Client) ConfigSet

func (c *Client) ConfigSet(parameter, value string) *StatusCmd

func (*Client) DbSize

func (c *Client) DbSize() *IntCmd

func (*Client) DebugObject

func (c *Client) DebugObject(key string) *StringCmd

func (*Client) Decr

func (c *Client) Decr(key string) *IntCmd

func (*Client) DecrBy

func (c *Client) DecrBy(key string, decrement int64) *IntCmd

func (*Client) Del

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

func (*Client) Dump

func (c *Client) Dump(key string) *StringCmd

func (*Client) Echo

func (c *Client) Echo(message string) *StringCmd

func (*Client) Eval

func (c *Client) Eval(script string, keys []string, args []string) *Cmd

func (*Client) EvalSha

func (c *Client) EvalSha(sha1 string, keys []string, args []string) *Cmd

func (*Client) Exists

func (c *Client) Exists(key string) *BoolCmd

func (*Client) Expire

func (c *Client) Expire(key string, expiration time.Duration) *BoolCmd

func (*Client) ExpireAt

func (c *Client) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Client) FlushAll

func (c *Client) FlushAll() *StatusCmd

func (*Client) FlushDb

func (c *Client) FlushDb() *StatusCmd

func (*Client) GeoAdd added in v3.2.11

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

func (*Client) GeoDist added in v3.2.13

func (c *Client) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Client) GeoHash added in v3.2.13

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

func (*Client) GeoRadius added in v3.2.11

func (c *Client) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Client) GeoRadiusByMember added in v3.2.13

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

func (*Client) Get

func (c *Client) Get(key string) *StringCmd

func (*Client) GetBit

func (c *Client) GetBit(key string, offset int64) *IntCmd

func (*Client) GetRange

func (c *Client) GetRange(key string, start, end int64) *StringCmd

func (*Client) GetSet

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

func (*Client) HDel

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

func (*Client) HExists

func (c *Client) HExists(key, field string) *BoolCmd

func (*Client) HGet

func (c *Client) HGet(key, field string) *StringCmd

func (*Client) HGetAll

func (c *Client) HGetAll(key string) *StringSliceCmd

func (*Client) HGetAllMap

func (c *Client) HGetAllMap(key string) *StringStringMapCmd

func (*Client) HIncrBy

func (c *Client) HIncrBy(key, field string, incr int64) *IntCmd

func (*Client) HIncrByFloat

func (c *Client) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Client) HKeys

func (c *Client) HKeys(key string) *StringSliceCmd

func (*Client) HLen

func (c *Client) HLen(key string) *IntCmd

func (*Client) HMGet

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

func (*Client) HMSet

func (c *Client) HMSet(key, field, value string, pairs ...string) *StatusCmd

func (*Client) HMSetMap added in v3.6.2

func (c *Client) HMSetMap(key string, fields map[string]string) *StatusCmd

func (*Client) HScan

func (c *Client) HScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Client) HSet

func (c *Client) HSet(key, field, value string) *BoolCmd

func (*Client) HSetNX

func (c *Client) HSetNX(key, field, value string) *BoolCmd

func (*Client) HVals

func (c *Client) HVals(key string) *StringSliceCmd

func (*Client) Incr

func (c *Client) Incr(key string) *IntCmd
Example
if err := client.Incr("counter").Err(); err != nil {
	panic(err)
}

n, err := client.Get("counter").Int64()
fmt.Println(n, err)
Output:

1 <nil>

func (*Client) IncrBy

func (c *Client) IncrBy(key string, value int64) *IntCmd

func (*Client) IncrByFloat

func (c *Client) IncrByFloat(key string, value float64) *FloatCmd

func (*Client) Info

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

func (*Client) Keys

func (c *Client) Keys(pattern string) *StringSliceCmd

func (*Client) LIndex

func (c *Client) LIndex(key string, index int64) *StringCmd

func (*Client) LInsert

func (c *Client) LInsert(key, op, pivot, value string) *IntCmd

func (*Client) LLen

func (c *Client) LLen(key string) *IntCmd

func (*Client) LPop

func (c *Client) LPop(key string) *StringCmd

func (*Client) LPush

func (c *Client) LPush(key string, values ...string) *IntCmd

func (*Client) LPushX

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

func (*Client) LRange

func (c *Client) LRange(key string, start, stop int64) *StringSliceCmd

func (*Client) LRem

func (c *Client) LRem(key string, count int64, value interface{}) *IntCmd

func (*Client) LSet

func (c *Client) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Client) LTrim

func (c *Client) LTrim(key string, start, stop int64) *StatusCmd

func (*Client) LastSave

func (c *Client) LastSave() *IntCmd

func (*Client) MGet

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

func (*Client) MSet

func (c *Client) MSet(pairs ...string) *StatusCmd

func (*Client) MSetNX

func (c *Client) MSetNX(pairs ...string) *BoolCmd

func (*Client) Migrate

func (c *Client) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Client) Move

func (c *Client) Move(key string, db int64) *BoolCmd

func (*Client) Multi

func (c *Client) Multi() *Multi

Deprecated. Use Watch instead.

func (*Client) ObjectEncoding

func (c *Client) ObjectEncoding(keys ...string) *StringCmd

func (*Client) ObjectIdleTime

func (c *Client) ObjectIdleTime(keys ...string) *DurationCmd

func (*Client) ObjectRefCount

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

func (*Client) PExpire

func (c *Client) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Client) PExpireAt

func (c *Client) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Client) PFAdd added in v3.2.14

func (c *Client) PFAdd(key string, fields ...string) *IntCmd

func (*Client) PFCount added in v3.2.14

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

func (*Client) PFMerge added in v3.2.14

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

func (*Client) PSubscribe added in v3.2.0

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

Subscribes the client to the given patterns.

func (*Client) PTTL

func (c *Client) PTTL(key string) *DurationCmd

func (*Client) Persist

func (c *Client) Persist(key string) *BoolCmd

func (*Client) Ping

func (c *Client) Ping() *StatusCmd

func (*Client) Pipeline

func (c *Client) Pipeline() *Pipeline

func (*Client) Pipelined

func (c *Client) Pipelined(fn func(*Pipeline) error) ([]Cmder, error)
Example
var incr *redis.IntCmd
_, err := client.Pipelined(func(pipe *redis.Pipeline) error {
	incr = pipe.Incr("counter1")
	pipe.Expire("counter1", time.Hour)
	return nil
})
fmt.Println(incr.Val(), err)
Output:

1 <nil>

func (*Client) PoolStats added in v3.2.29

func (c *Client) PoolStats() *PoolStats

PoolStats returns connection pool stats.

func (*Client) Process

func (c *Client) Process(cmd Cmder)

func (*Client) PubSub

func (c *Client) PubSub() *PubSub

Deprecated. Use Subscribe/PSubscribe instead.

func (*Client) PubSubChannels

func (c *Client) PubSubChannels(pattern string) *StringSliceCmd

func (*Client) PubSubNumPat

func (c *Client) PubSubNumPat() *IntCmd

func (*Client) PubSubNumSub

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

func (*Client) Publish

func (c *Client) Publish(channel, message string) *IntCmd

Posts a message to the given channel.

func (*Client) Quit

func (c *Client) Quit() *StatusCmd

func (*Client) RPop

func (c *Client) RPop(key string) *StringCmd

func (*Client) RPopLPush

func (c *Client) RPopLPush(source, destination string) *StringCmd

func (*Client) RPush

func (c *Client) RPush(key string, values ...string) *IntCmd

func (*Client) RPushX

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

func (*Client) RandomKey

func (c *Client) RandomKey() *StringCmd

func (*Client) ReadWrite added in v3.2.26

func (c *Client) ReadWrite() *StatusCmd

func (*Client) Readonly added in v3.2.26

func (c *Client) Readonly() *StatusCmd

func (*Client) Rename

func (c *Client) Rename(key, newkey string) *StatusCmd

func (*Client) RenameNX

func (c *Client) RenameNX(key, newkey string) *BoolCmd

func (*Client) Restore

func (c *Client) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Client) RestoreReplace added in v3.2.0

func (c *Client) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Client) SAdd

func (c *Client) SAdd(key string, members ...string) *IntCmd

func (*Client) SCard

func (c *Client) SCard(key string) *IntCmd

func (*Client) SDiff

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

func (*Client) SDiffStore

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

func (*Client) SInter

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

func (*Client) SInterStore

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

func (*Client) SIsMember

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

func (*Client) SMembers

func (c *Client) SMembers(key string) *StringSliceCmd

func (*Client) SMove

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

func (*Client) SPop

func (c *Client) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Client) SPopN added in v3.6.3

func (c *Client) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Client) SRandMember

func (c *Client) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Client) SRandMemberN added in v3.2.6

func (c *Client) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Client) SRem

func (c *Client) SRem(key string, members ...string) *IntCmd

func (*Client) SScan

func (c *Client) SScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Client) SUnion

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

func (*Client) SUnionStore

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

func (*Client) Save

func (c *Client) Save() *StatusCmd

func (*Client) Scan

func (c *Client) Scan(cursor int64, match string, count int64) *ScanCmd
Example
client.FlushDb()
for i := 0; i < 33; i++ {
	err := client.Set(fmt.Sprintf("key%d", i), "value", 0).Err()
	if err != nil {
		panic(err)
	}
}

var cursor int64
var n int
for {
	var keys []string
	var err error
	cursor, keys, err = client.Scan(cursor, "", 10).Result()
	if err != nil {
		panic(err)
	}
	n += len(keys)
	if cursor == 0 {
		break
	}
}

fmt.Printf("found %d keys\n", n)
Output:

found 33 keys

func (*Client) ScriptExists

func (c *Client) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Client) ScriptFlush

func (c *Client) ScriptFlush() *StatusCmd

func (*Client) ScriptKill

func (c *Client) ScriptKill() *StatusCmd

func (*Client) ScriptLoad

func (c *Client) ScriptLoad(script string) *StringCmd

func (*Client) Select

func (c *Client) Select(index int64) *StatusCmd

func (*Client) Set

func (c *Client) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Zero expiration means the key has no expiration time.

Example
// Last argument is expiration. Zero means the key has no
// expiration time.
err := client.Set("key", "value", 0).Err()
if err != nil {
	panic(err)
}

// key2 will expire in an hour.
err = client.Set("key2", "value", time.Hour).Err()
if err != nil {
	panic(err)
}
Output:

func (*Client) SetBit

func (c *Client) SetBit(key string, offset int64, value int) *IntCmd

func (*Client) SetNX

func (c *Client) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Client) SetRange

func (c *Client) SetRange(key string, offset int64, value string) *IntCmd

func (*Client) SetXX

func (c *Client) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Client) Shutdown

func (c *Client) Shutdown() *StatusCmd

func (*Client) ShutdownNoSave

func (c *Client) ShutdownNoSave() *StatusCmd

func (*Client) ShutdownSave

func (c *Client) ShutdownSave() *StatusCmd

func (*Client) SlaveOf

func (c *Client) SlaveOf(host, port string) *StatusCmd

func (*Client) SlowLog

func (c *Client) SlowLog()

func (*Client) Sort

func (c *Client) Sort(key string, sort Sort) *StringSliceCmd

func (*Client) SortInterfaces added in v3.2.28

func (c *Client) SortInterfaces(key string, sort Sort) *SliceCmd

func (*Client) StrLen

func (c *Client) StrLen(key string) *IntCmd

func (*Client) String

func (c *Client) String() string

func (*Client) Subscribe added in v3.2.0

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

Subscribes the client to the specified channels.

func (*Client) Sync

func (c *Client) Sync()

func (*Client) TTL

func (c *Client) TTL(key string) *DurationCmd

func (*Client) Time

func (c *Client) Time() *StringSliceCmd

func (*Client) Type

func (c *Client) Type(key string) *StatusCmd

func (*Client) Watch added in v3.2.15

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

Watch creates new transaction and marks the keys to be watched for conditional execution of a transaction.

Example
var incr func(string) error

// Transactionally increments key using GET and SET commands.
incr = func(key string) error {
	tx, err := client.Watch(key)
	if err != nil {
		return err
	}
	defer tx.Close()

	n, err := tx.Get(key).Int64()
	if err != nil && err != redis.Nil {
		return err
	}

	_, err = tx.Exec(func() error {
		tx.Set(key, strconv.FormatInt(n+1, 10), 0)
		return nil
	})
	if err == redis.TxFailedErr {
		return incr(key)
	}
	return err
}

var wg sync.WaitGroup
for i := 0; i < 100; i++ {
	wg.Add(1)
	go func() {
		defer wg.Done()

		err := incr("counter3")
		if err != nil {
			panic(err)
		}
	}()
}
wg.Wait()

n, err := client.Get("counter3").Int64()
fmt.Println(n, err)
Output:

100 <nil>

func (*Client) ZAdd

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

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

func (*Client) ZAddCh added in v3.2.7

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

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

func (*Client) ZAddNX added in v3.2.7

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

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

func (*Client) ZAddNXCh added in v3.2.7

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

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

func (*Client) ZAddXX added in v3.2.7

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

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

func (*Client) ZAddXXCh added in v3.2.7

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

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

func (*Client) ZCard

func (c *Client) ZCard(key string) *IntCmd

func (*Client) ZCount

func (c *Client) ZCount(key, min, max string) *IntCmd

func (*Client) ZIncr added in v3.2.7

func (c *Client) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Client) ZIncrBy

func (c *Client) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*Client) ZIncrNX added in v3.2.7

func (c *Client) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Client) ZIncrXX added in v3.2.7

func (c *Client) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Client) ZInterStore

func (c *Client) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*Client) ZRange

func (c *Client) ZRange(key string, start, stop int64) *StringSliceCmd

func (*Client) ZRangeByLex added in v3.2.6

func (c *Client) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Client) ZRangeByScore

func (c *Client) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Client) ZRangeByScoreWithScores

func (c *Client) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Client) ZRangeWithScores

func (c *Client) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Client) ZRank

func (c *Client) ZRank(key, member string) *IntCmd

func (*Client) ZRem

func (c *Client) ZRem(key string, members ...string) *IntCmd

func (*Client) ZRemRangeByRank

func (c *Client) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*Client) ZRemRangeByScore

func (c *Client) ZRemRangeByScore(key, min, max string) *IntCmd

func (*Client) ZRevRange

func (c *Client) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*Client) ZRevRangeByLex added in v3.2.6

func (c *Client) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Client) ZRevRangeByScore

func (c *Client) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Client) ZRevRangeByScoreWithScores

func (c *Client) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Client) ZRevRangeWithScores

func (c *Client) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Client) ZRevRank

func (c *Client) ZRevRank(key, member string) *IntCmd

func (*Client) ZScan

func (c *Client) ZScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Client) ZScore

func (c *Client) ZScore(key, member string) *FloatCmd

func (*Client) ZUnionStore

func (c *Client) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type ClusterClient

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

ClusterClient is a Redis Cluster client representing a pool of zero or more underlying connections. It's safe for concurrent use by multiple goroutines.

func NewClusterClient

func NewClusterClient(opt *ClusterOptions) *ClusterClient

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

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

func (*ClusterClient) Append

func (c *ClusterClient) Append(key, value string) *IntCmd

func (*ClusterClient) Auth

func (c *ClusterClient) Auth(password string) *StatusCmd

func (*ClusterClient) BLPop

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

func (*ClusterClient) BRPop

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

func (*ClusterClient) BRPopLPush

func (c *ClusterClient) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*ClusterClient) BgRewriteAOF

func (c *ClusterClient) BgRewriteAOF() *StatusCmd

func (*ClusterClient) BgSave

func (c *ClusterClient) BgSave() *StatusCmd

func (*ClusterClient) BitCount

func (c *ClusterClient) BitCount(key string, bitCount *BitCount) *IntCmd

func (*ClusterClient) BitOpAnd

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

func (*ClusterClient) BitOpNot

func (c *ClusterClient) BitOpNot(destKey string, key string) *IntCmd

func (*ClusterClient) BitOpOr

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

func (*ClusterClient) BitOpXor

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

func (*ClusterClient) BitPos

func (c *ClusterClient) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*ClusterClient) ClientKill

func (c *ClusterClient) ClientKill(ipPort string) *StatusCmd

func (*ClusterClient) ClientList

func (c *ClusterClient) ClientList() *StringCmd

func (*ClusterClient) ClientPause

func (c *ClusterClient) ClientPause(dur time.Duration) *BoolCmd

func (*ClusterClient) ClientSetName added in v3.2.13

func (c *ClusterClient) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the one of many connections in the pool.

func (*ClusterClient) Close

func (c *ClusterClient) Close() error

Close closes the cluster client, releasing any open resources.

It is rare to Close a ClusterClient, as the ClusterClient is meant to be long-lived and shared between many goroutines.

func (*ClusterClient) ClusterAddSlots

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

func (*ClusterClient) ClusterAddSlotsRange

func (c *ClusterClient) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*ClusterClient) ClusterCountFailureReports added in v3.2.26

func (c *ClusterClient) ClusterCountFailureReports(nodeID string) *IntCmd

func (*ClusterClient) ClusterCountKeysInSlot added in v3.2.26

func (c *ClusterClient) ClusterCountKeysInSlot(slot int) *IntCmd

func (*ClusterClient) ClusterDelSlots added in v3.2.26

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

func (*ClusterClient) ClusterDelSlotsRange added in v3.2.26

func (c *ClusterClient) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*ClusterClient) ClusterFailover

func (c *ClusterClient) ClusterFailover() *StatusCmd

func (*ClusterClient) ClusterForget added in v3.2.20

func (c *ClusterClient) ClusterForget(nodeID string) *StatusCmd

func (*ClusterClient) ClusterInfo

func (c *ClusterClient) ClusterInfo() *StringCmd

func (*ClusterClient) ClusterKeySlot added in v3.2.26

func (c *ClusterClient) ClusterKeySlot(key string) *IntCmd

func (*ClusterClient) ClusterMeet

func (c *ClusterClient) ClusterMeet(host, port string) *StatusCmd

func (*ClusterClient) ClusterNodes

func (c *ClusterClient) ClusterNodes() *StringCmd

func (*ClusterClient) ClusterReplicate

func (c *ClusterClient) ClusterReplicate(nodeID string) *StatusCmd

func (*ClusterClient) ClusterResetHard added in v3.2.24

func (c *ClusterClient) ClusterResetHard() *StatusCmd

func (*ClusterClient) ClusterResetSoft added in v3.2.24

func (c *ClusterClient) ClusterResetSoft() *StatusCmd

func (*ClusterClient) ClusterSaveConfig added in v3.2.26

func (c *ClusterClient) ClusterSaveConfig() *StatusCmd

func (*ClusterClient) ClusterSlaves added in v3.2.26

func (c *ClusterClient) ClusterSlaves(nodeID string) *StringSliceCmd

func (*ClusterClient) ClusterSlots

func (c *ClusterClient) ClusterSlots() *ClusterSlotCmd

func (*ClusterClient) ConfigGet

func (c *ClusterClient) ConfigGet(parameter string) *SliceCmd

func (*ClusterClient) ConfigResetStat

func (c *ClusterClient) ConfigResetStat() *StatusCmd

func (*ClusterClient) ConfigSet

func (c *ClusterClient) ConfigSet(parameter, value string) *StatusCmd

func (*ClusterClient) DbSize

func (c *ClusterClient) DbSize() *IntCmd

func (*ClusterClient) DebugObject

func (c *ClusterClient) DebugObject(key string) *StringCmd

func (*ClusterClient) Decr

func (c *ClusterClient) Decr(key string) *IntCmd

func (*ClusterClient) DecrBy

func (c *ClusterClient) DecrBy(key string, decrement int64) *IntCmd

func (*ClusterClient) Del

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

func (*ClusterClient) Dump

func (c *ClusterClient) Dump(key string) *StringCmd

func (*ClusterClient) Echo

func (c *ClusterClient) Echo(message string) *StringCmd

func (*ClusterClient) Eval

func (c *ClusterClient) Eval(script string, keys []string, args []string) *Cmd

func (*ClusterClient) EvalSha

func (c *ClusterClient) EvalSha(sha1 string, keys []string, args []string) *Cmd

func (*ClusterClient) Exists

func (c *ClusterClient) Exists(key string) *BoolCmd

func (*ClusterClient) Expire

func (c *ClusterClient) Expire(key string, expiration time.Duration) *BoolCmd

func (*ClusterClient) ExpireAt

func (c *ClusterClient) ExpireAt(key string, tm time.Time) *BoolCmd

func (*ClusterClient) FlushAll

func (c *ClusterClient) FlushAll() *StatusCmd

func (*ClusterClient) FlushDb

func (c *ClusterClient) FlushDb() *StatusCmd

func (*ClusterClient) GeoAdd added in v3.2.11

func (c *ClusterClient) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*ClusterClient) GeoDist added in v3.2.13

func (c *ClusterClient) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*ClusterClient) GeoHash added in v3.2.13

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

func (*ClusterClient) GeoRadius added in v3.2.11

func (c *ClusterClient) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterClient) GeoRadiusByMember added in v3.2.13

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

func (*ClusterClient) Get

func (c *ClusterClient) Get(key string) *StringCmd

func (*ClusterClient) GetBit

func (c *ClusterClient) GetBit(key string, offset int64) *IntCmd

func (*ClusterClient) GetRange

func (c *ClusterClient) GetRange(key string, start, end int64) *StringCmd

func (*ClusterClient) GetSet

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

func (*ClusterClient) HDel

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

func (*ClusterClient) HExists

func (c *ClusterClient) HExists(key, field string) *BoolCmd

func (*ClusterClient) HGet

func (c *ClusterClient) HGet(key, field string) *StringCmd

func (*ClusterClient) HGetAll

func (c *ClusterClient) HGetAll(key string) *StringSliceCmd

func (*ClusterClient) HGetAllMap

func (c *ClusterClient) HGetAllMap(key string) *StringStringMapCmd

func (*ClusterClient) HIncrBy

func (c *ClusterClient) HIncrBy(key, field string, incr int64) *IntCmd

func (*ClusterClient) HIncrByFloat

func (c *ClusterClient) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*ClusterClient) HKeys

func (c *ClusterClient) HKeys(key string) *StringSliceCmd

func (*ClusterClient) HLen

func (c *ClusterClient) HLen(key string) *IntCmd

func (*ClusterClient) HMGet

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

func (*ClusterClient) HMSet

func (c *ClusterClient) HMSet(key, field, value string, pairs ...string) *StatusCmd

func (*ClusterClient) HMSetMap added in v3.6.2

func (c *ClusterClient) HMSetMap(key string, fields map[string]string) *StatusCmd

func (*ClusterClient) HScan

func (c *ClusterClient) HScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*ClusterClient) HSet

func (c *ClusterClient) HSet(key, field, value string) *BoolCmd

func (*ClusterClient) HSetNX

func (c *ClusterClient) HSetNX(key, field, value string) *BoolCmd

func (*ClusterClient) HVals

func (c *ClusterClient) HVals(key string) *StringSliceCmd

func (*ClusterClient) Incr

func (c *ClusterClient) Incr(key string) *IntCmd

func (*ClusterClient) IncrBy

func (c *ClusterClient) IncrBy(key string, value int64) *IntCmd

func (*ClusterClient) IncrByFloat

func (c *ClusterClient) IncrByFloat(key string, value float64) *FloatCmd

func (*ClusterClient) Info

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

func (*ClusterClient) Keys

func (c *ClusterClient) Keys(pattern string) *StringSliceCmd

func (*ClusterClient) LIndex

func (c *ClusterClient) LIndex(key string, index int64) *StringCmd

func (*ClusterClient) LInsert

func (c *ClusterClient) LInsert(key, op, pivot, value string) *IntCmd

func (*ClusterClient) LLen

func (c *ClusterClient) LLen(key string) *IntCmd

func (*ClusterClient) LPop

func (c *ClusterClient) LPop(key string) *StringCmd

func (*ClusterClient) LPush

func (c *ClusterClient) LPush(key string, values ...string) *IntCmd

func (*ClusterClient) LPushX

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

func (*ClusterClient) LRange

func (c *ClusterClient) LRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterClient) LRem

func (c *ClusterClient) LRem(key string, count int64, value interface{}) *IntCmd

func (*ClusterClient) LSet

func (c *ClusterClient) LSet(key string, index int64, value interface{}) *StatusCmd

func (*ClusterClient) LTrim

func (c *ClusterClient) LTrim(key string, start, stop int64) *StatusCmd

func (*ClusterClient) LastSave

func (c *ClusterClient) LastSave() *IntCmd

func (*ClusterClient) MGet

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

func (*ClusterClient) MSet

func (c *ClusterClient) MSet(pairs ...string) *StatusCmd

func (*ClusterClient) MSetNX

func (c *ClusterClient) MSetNX(pairs ...string) *BoolCmd

func (*ClusterClient) Migrate

func (c *ClusterClient) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*ClusterClient) Move

func (c *ClusterClient) Move(key string, db int64) *BoolCmd

func (*ClusterClient) ObjectEncoding

func (c *ClusterClient) ObjectEncoding(keys ...string) *StringCmd

func (*ClusterClient) ObjectIdleTime

func (c *ClusterClient) ObjectIdleTime(keys ...string) *DurationCmd

func (*ClusterClient) ObjectRefCount

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

func (*ClusterClient) PExpire

func (c *ClusterClient) PExpire(key string, expiration time.Duration) *BoolCmd

func (*ClusterClient) PExpireAt

func (c *ClusterClient) PExpireAt(key string, tm time.Time) *BoolCmd

func (*ClusterClient) PFAdd added in v3.2.14

func (c *ClusterClient) PFAdd(key string, fields ...string) *IntCmd

func (*ClusterClient) PFCount added in v3.2.14

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

func (*ClusterClient) PFMerge added in v3.2.14

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

func (*ClusterClient) PTTL

func (c *ClusterClient) PTTL(key string) *DurationCmd

func (*ClusterClient) Persist

func (c *ClusterClient) Persist(key string) *BoolCmd

func (*ClusterClient) Ping

func (c *ClusterClient) Ping() *StatusCmd

func (*ClusterClient) Pipeline

func (c *ClusterClient) Pipeline() *ClusterPipeline

Pipeline creates a new pipeline which is able to execute commands against multiple shards. It's NOT safe for concurrent use by multiple goroutines.

func (*ClusterClient) Pipelined added in v3.6.1

func (c *ClusterClient) Pipelined(fn func(*ClusterPipeline) error) ([]Cmder, error)

func (*ClusterClient) PoolStats added in v3.2.29

func (c *ClusterClient) PoolStats() *PoolStats

PoolStats returns accumulated connection pool stats.

func (*ClusterClient) Process

func (c *ClusterClient) Process(cmd Cmder)

func (*ClusterClient) PubSubChannels

func (c *ClusterClient) PubSubChannels(pattern string) *StringSliceCmd

func (*ClusterClient) PubSubNumPat

func (c *ClusterClient) PubSubNumPat() *IntCmd

func (*ClusterClient) PubSubNumSub

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

func (*ClusterClient) Quit

func (c *ClusterClient) Quit() *StatusCmd

func (*ClusterClient) RPop

func (c *ClusterClient) RPop(key string) *StringCmd

func (*ClusterClient) RPopLPush

func (c *ClusterClient) RPopLPush(source, destination string) *StringCmd

func (*ClusterClient) RPush

func (c *ClusterClient) RPush(key string, values ...string) *IntCmd

func (*ClusterClient) RPushX

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

func (*ClusterClient) RandomKey

func (c *ClusterClient) RandomKey() *StringCmd

func (*ClusterClient) ReadWrite added in v3.2.26

func (c *ClusterClient) ReadWrite() *StatusCmd

func (*ClusterClient) Readonly added in v3.2.26

func (c *ClusterClient) Readonly() *StatusCmd

func (*ClusterClient) Rename

func (c *ClusterClient) Rename(key, newkey string) *StatusCmd

func (*ClusterClient) RenameNX

func (c *ClusterClient) RenameNX(key, newkey string) *BoolCmd

func (*ClusterClient) Restore

func (c *ClusterClient) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*ClusterClient) RestoreReplace added in v3.2.0

func (c *ClusterClient) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*ClusterClient) SAdd

func (c *ClusterClient) SAdd(key string, members ...string) *IntCmd

func (*ClusterClient) SCard

func (c *ClusterClient) SCard(key string) *IntCmd

func (*ClusterClient) SDiff

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

func (*ClusterClient) SDiffStore

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

func (*ClusterClient) SInter

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

func (*ClusterClient) SInterStore

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

func (*ClusterClient) SIsMember

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

func (*ClusterClient) SMembers

func (c *ClusterClient) SMembers(key string) *StringSliceCmd

func (*ClusterClient) SMove

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

func (*ClusterClient) SPop

func (c *ClusterClient) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*ClusterClient) SPopN added in v3.6.3

func (c *ClusterClient) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*ClusterClient) SRandMember

func (c *ClusterClient) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*ClusterClient) SRandMemberN added in v3.2.6

func (c *ClusterClient) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*ClusterClient) SRem

func (c *ClusterClient) SRem(key string, members ...string) *IntCmd

func (*ClusterClient) SScan

func (c *ClusterClient) SScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*ClusterClient) SUnion

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

func (*ClusterClient) SUnionStore

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

func (*ClusterClient) Save

func (c *ClusterClient) Save() *StatusCmd

func (*ClusterClient) Scan

func (c *ClusterClient) Scan(cursor int64, match string, count int64) *ScanCmd

func (*ClusterClient) ScriptExists

func (c *ClusterClient) ScriptExists(scripts ...string) *BoolSliceCmd

func (*ClusterClient) ScriptFlush

func (c *ClusterClient) ScriptFlush() *StatusCmd

func (*ClusterClient) ScriptKill

func (c *ClusterClient) ScriptKill() *StatusCmd

func (*ClusterClient) ScriptLoad

func (c *ClusterClient) ScriptLoad(script string) *StringCmd

func (*ClusterClient) Select

func (c *ClusterClient) Select(index int64) *StatusCmd

func (*ClusterClient) Set

func (c *ClusterClient) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Zero expiration means the key has no expiration time.

func (*ClusterClient) SetBit

func (c *ClusterClient) SetBit(key string, offset int64, value int) *IntCmd

func (*ClusterClient) SetNX

func (c *ClusterClient) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*ClusterClient) SetRange

func (c *ClusterClient) SetRange(key string, offset int64, value string) *IntCmd

func (*ClusterClient) SetXX added in v3.4.0

func (c *ClusterClient) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*ClusterClient) Shutdown

func (c *ClusterClient) Shutdown() *StatusCmd

func (*ClusterClient) ShutdownNoSave

func (c *ClusterClient) ShutdownNoSave() *StatusCmd

func (*ClusterClient) ShutdownSave

func (c *ClusterClient) ShutdownSave() *StatusCmd

func (*ClusterClient) SlaveOf

func (c *ClusterClient) SlaveOf(host, port string) *StatusCmd

func (*ClusterClient) SlowLog

func (c *ClusterClient) SlowLog()

func (*ClusterClient) Sort

func (c *ClusterClient) Sort(key string, sort Sort) *StringSliceCmd

func (*ClusterClient) SortInterfaces added in v3.2.28

func (c *ClusterClient) SortInterfaces(key string, sort Sort) *SliceCmd

func (*ClusterClient) StrLen

func (c *ClusterClient) StrLen(key string) *IntCmd

func (*ClusterClient) Sync

func (c *ClusterClient) Sync()

func (*ClusterClient) TTL

func (c *ClusterClient) TTL(key string) *DurationCmd

func (*ClusterClient) Time

func (c *ClusterClient) Time() *StringSliceCmd

func (*ClusterClient) Type

func (c *ClusterClient) Type(key string) *StatusCmd

func (*ClusterClient) Watch added in v3.2.23

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

Watch creates new transaction and marks the keys to be watched for conditional execution of a transaction.

func (*ClusterClient) ZAdd

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

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

func (*ClusterClient) ZAddCh added in v3.2.7

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

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

func (*ClusterClient) ZAddNX added in v3.2.7

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

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

func (*ClusterClient) ZAddNXCh added in v3.2.7

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

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

func (*ClusterClient) ZAddXX added in v3.2.7

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

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

func (*ClusterClient) ZAddXXCh added in v3.2.7

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

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

func (*ClusterClient) ZCard

func (c *ClusterClient) ZCard(key string) *IntCmd

func (*ClusterClient) ZCount

func (c *ClusterClient) ZCount(key, min, max string) *IntCmd

func (*ClusterClient) ZIncr added in v3.2.7

func (c *ClusterClient) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*ClusterClient) ZIncrBy

func (c *ClusterClient) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*ClusterClient) ZIncrNX added in v3.2.7

func (c *ClusterClient) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*ClusterClient) ZIncrXX added in v3.2.7

func (c *ClusterClient) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*ClusterClient) ZInterStore

func (c *ClusterClient) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*ClusterClient) ZRange

func (c *ClusterClient) ZRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterClient) ZRangeByLex added in v3.2.6

func (c *ClusterClient) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterClient) ZRangeByScore

func (c *ClusterClient) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterClient) ZRangeByScoreWithScores

func (c *ClusterClient) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*ClusterClient) ZRangeWithScores

func (c *ClusterClient) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*ClusterClient) ZRank

func (c *ClusterClient) ZRank(key, member string) *IntCmd

func (*ClusterClient) ZRem

func (c *ClusterClient) ZRem(key string, members ...string) *IntCmd

func (*ClusterClient) ZRemRangeByRank

func (c *ClusterClient) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*ClusterClient) ZRemRangeByScore

func (c *ClusterClient) ZRemRangeByScore(key, min, max string) *IntCmd

func (*ClusterClient) ZRevRange

func (c *ClusterClient) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterClient) ZRevRangeByLex added in v3.2.6

func (c *ClusterClient) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterClient) ZRevRangeByScore

func (c *ClusterClient) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterClient) ZRevRangeByScoreWithScores

func (c *ClusterClient) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*ClusterClient) ZRevRangeWithScores

func (c *ClusterClient) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*ClusterClient) ZRevRank

func (c *ClusterClient) ZRevRank(key, member string) *IntCmd

func (*ClusterClient) ZScan

func (c *ClusterClient) ZScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*ClusterClient) ZScore

func (c *ClusterClient) ZScore(key, member string) *FloatCmd

func (*ClusterClient) ZUnionStore

func (c *ClusterClient) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type ClusterOptions

type ClusterOptions struct {
	// A seed list of host:port addresses of cluster nodes.
	Addrs []string

	// The maximum number of retries before giving up. Command is retried
	// on network errors and MOVED/ASK redirects.
	// Default is 16.
	MaxRedirects int

	Password string

	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration

	// PoolSize applies per cluster node and not for the whole cluster.
	PoolSize           int
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
}

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

type ClusterPipeline

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

ClusterPipeline is not thread-safe.

func (*ClusterPipeline) Append

func (c *ClusterPipeline) Append(key, value string) *IntCmd

func (*ClusterPipeline) Auth

func (c *ClusterPipeline) Auth(password string) *StatusCmd

func (*ClusterPipeline) BLPop

func (c *ClusterPipeline) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*ClusterPipeline) BRPop

func (c *ClusterPipeline) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*ClusterPipeline) BRPopLPush

func (c *ClusterPipeline) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*ClusterPipeline) BgRewriteAOF

func (c *ClusterPipeline) BgRewriteAOF() *StatusCmd

func (*ClusterPipeline) BgSave

func (c *ClusterPipeline) BgSave() *StatusCmd

func (*ClusterPipeline) BitCount

func (c *ClusterPipeline) BitCount(key string, bitCount *BitCount) *IntCmd

func (*ClusterPipeline) BitOpAnd

func (c *ClusterPipeline) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*ClusterPipeline) BitOpNot

func (c *ClusterPipeline) BitOpNot(destKey string, key string) *IntCmd

func (*ClusterPipeline) BitOpOr

func (c *ClusterPipeline) BitOpOr(destKey string, keys ...string) *IntCmd

func (*ClusterPipeline) BitOpXor

func (c *ClusterPipeline) BitOpXor(destKey string, keys ...string) *IntCmd

func (*ClusterPipeline) BitPos

func (c *ClusterPipeline) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*ClusterPipeline) ClientKill

func (c *ClusterPipeline) ClientKill(ipPort string) *StatusCmd

func (*ClusterPipeline) ClientList

func (c *ClusterPipeline) ClientList() *StringCmd

func (*ClusterPipeline) ClientPause

func (c *ClusterPipeline) ClientPause(dur time.Duration) *BoolCmd

func (*ClusterPipeline) ClientSetName added in v3.2.13

func (c *ClusterPipeline) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the one of many connections in the pool.

func (*ClusterPipeline) Close

func (pipe *ClusterPipeline) Close() error

Close closes the pipeline, releasing any open resources.

func (*ClusterPipeline) ClusterAddSlots

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

func (*ClusterPipeline) ClusterAddSlotsRange

func (c *ClusterPipeline) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*ClusterPipeline) ClusterCountFailureReports added in v3.2.26

func (c *ClusterPipeline) ClusterCountFailureReports(nodeID string) *IntCmd

func (*ClusterPipeline) ClusterCountKeysInSlot added in v3.2.26

func (c *ClusterPipeline) ClusterCountKeysInSlot(slot int) *IntCmd

func (*ClusterPipeline) ClusterDelSlots added in v3.2.26

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

func (*ClusterPipeline) ClusterDelSlotsRange added in v3.2.26

func (c *ClusterPipeline) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*ClusterPipeline) ClusterFailover

func (c *ClusterPipeline) ClusterFailover() *StatusCmd

func (*ClusterPipeline) ClusterForget added in v3.2.20

func (c *ClusterPipeline) ClusterForget(nodeID string) *StatusCmd

func (*ClusterPipeline) ClusterInfo

func (c *ClusterPipeline) ClusterInfo() *StringCmd

func (*ClusterPipeline) ClusterKeySlot added in v3.2.26

func (c *ClusterPipeline) ClusterKeySlot(key string) *IntCmd

func (*ClusterPipeline) ClusterMeet

func (c *ClusterPipeline) ClusterMeet(host, port string) *StatusCmd

func (*ClusterPipeline) ClusterNodes

func (c *ClusterPipeline) ClusterNodes() *StringCmd

func (*ClusterPipeline) ClusterReplicate

func (c *ClusterPipeline) ClusterReplicate(nodeID string) *StatusCmd

func (*ClusterPipeline) ClusterResetHard added in v3.2.24

func (c *ClusterPipeline) ClusterResetHard() *StatusCmd

func (*ClusterPipeline) ClusterResetSoft added in v3.2.24

func (c *ClusterPipeline) ClusterResetSoft() *StatusCmd

func (*ClusterPipeline) ClusterSaveConfig added in v3.2.26

func (c *ClusterPipeline) ClusterSaveConfig() *StatusCmd

func (*ClusterPipeline) ClusterSlaves added in v3.2.26

func (c *ClusterPipeline) ClusterSlaves(nodeID string) *StringSliceCmd

func (*ClusterPipeline) ClusterSlots

func (c *ClusterPipeline) ClusterSlots() *ClusterSlotCmd

func (*ClusterPipeline) ConfigGet

func (c *ClusterPipeline) ConfigGet(parameter string) *SliceCmd

func (*ClusterPipeline) ConfigResetStat

func (c *ClusterPipeline) ConfigResetStat() *StatusCmd

func (*ClusterPipeline) ConfigSet

func (c *ClusterPipeline) ConfigSet(parameter, value string) *StatusCmd

func (*ClusterPipeline) DbSize

func (c *ClusterPipeline) DbSize() *IntCmd

func (*ClusterPipeline) DebugObject

func (c *ClusterPipeline) DebugObject(key string) *StringCmd

func (*ClusterPipeline) Decr

func (c *ClusterPipeline) Decr(key string) *IntCmd

func (*ClusterPipeline) DecrBy

func (c *ClusterPipeline) DecrBy(key string, decrement int64) *IntCmd

func (*ClusterPipeline) Del

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

func (*ClusterPipeline) Discard

func (pipe *ClusterPipeline) Discard() error

Discard resets the pipeline and discards queued commands.

func (*ClusterPipeline) Dump

func (c *ClusterPipeline) Dump(key string) *StringCmd

func (*ClusterPipeline) Echo

func (c *ClusterPipeline) Echo(message string) *StringCmd

func (*ClusterPipeline) Eval

func (c *ClusterPipeline) Eval(script string, keys []string, args []string) *Cmd

func (*ClusterPipeline) EvalSha

func (c *ClusterPipeline) EvalSha(sha1 string, keys []string, args []string) *Cmd

func (*ClusterPipeline) Exec

func (pipe *ClusterPipeline) Exec() (cmds []Cmder, retErr error)

func (*ClusterPipeline) Exists

func (c *ClusterPipeline) Exists(key string) *BoolCmd

func (*ClusterPipeline) Expire

func (c *ClusterPipeline) Expire(key string, expiration time.Duration) *BoolCmd

func (*ClusterPipeline) ExpireAt

func (c *ClusterPipeline) ExpireAt(key string, tm time.Time) *BoolCmd

func (*ClusterPipeline) FlushAll

func (c *ClusterPipeline) FlushAll() *StatusCmd

func (*ClusterPipeline) FlushDb

func (c *ClusterPipeline) FlushDb() *StatusCmd

func (*ClusterPipeline) GeoAdd added in v3.2.11

func (c *ClusterPipeline) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*ClusterPipeline) GeoDist added in v3.2.13

func (c *ClusterPipeline) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*ClusterPipeline) GeoHash added in v3.2.13

func (c *ClusterPipeline) GeoHash(key string, members ...string) *StringSliceCmd

func (*ClusterPipeline) GeoRadius added in v3.2.11

func (c *ClusterPipeline) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterPipeline) GeoRadiusByMember added in v3.2.13

func (c *ClusterPipeline) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*ClusterPipeline) Get

func (c *ClusterPipeline) Get(key string) *StringCmd

func (*ClusterPipeline) GetBit

func (c *ClusterPipeline) GetBit(key string, offset int64) *IntCmd

func (*ClusterPipeline) GetRange

func (c *ClusterPipeline) GetRange(key string, start, end int64) *StringCmd

func (*ClusterPipeline) GetSet

func (c *ClusterPipeline) GetSet(key string, value interface{}) *StringCmd

func (*ClusterPipeline) HDel

func (c *ClusterPipeline) HDel(key string, fields ...string) *IntCmd

func (*ClusterPipeline) HExists

func (c *ClusterPipeline) HExists(key, field string) *BoolCmd

func (*ClusterPipeline) HGet

func (c *ClusterPipeline) HGet(key, field string) *StringCmd

func (*ClusterPipeline) HGetAll

func (c *ClusterPipeline) HGetAll(key string) *StringSliceCmd

func (*ClusterPipeline) HGetAllMap

func (c *ClusterPipeline) HGetAllMap(key string) *StringStringMapCmd

func (*ClusterPipeline) HIncrBy

func (c *ClusterPipeline) HIncrBy(key, field string, incr int64) *IntCmd

func (*ClusterPipeline) HIncrByFloat

func (c *ClusterPipeline) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*ClusterPipeline) HKeys

func (c *ClusterPipeline) HKeys(key string) *StringSliceCmd

func (*ClusterPipeline) HLen

func (c *ClusterPipeline) HLen(key string) *IntCmd

func (*ClusterPipeline) HMGet

func (c *ClusterPipeline) HMGet(key string, fields ...string) *SliceCmd

func (*ClusterPipeline) HMSet

func (c *ClusterPipeline) HMSet(key, field, value string, pairs ...string) *StatusCmd

func (*ClusterPipeline) HMSetMap added in v3.6.2

func (c *ClusterPipeline) HMSetMap(key string, fields map[string]string) *StatusCmd

func (*ClusterPipeline) HScan

func (c *ClusterPipeline) HScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*ClusterPipeline) HSet

func (c *ClusterPipeline) HSet(key, field, value string) *BoolCmd

func (*ClusterPipeline) HSetNX

func (c *ClusterPipeline) HSetNX(key, field, value string) *BoolCmd

func (*ClusterPipeline) HVals

func (c *ClusterPipeline) HVals(key string) *StringSliceCmd

func (*ClusterPipeline) Incr

func (c *ClusterPipeline) Incr(key string) *IntCmd

func (*ClusterPipeline) IncrBy

func (c *ClusterPipeline) IncrBy(key string, value int64) *IntCmd

func (*ClusterPipeline) IncrByFloat

func (c *ClusterPipeline) IncrByFloat(key string, value float64) *FloatCmd

func (*ClusterPipeline) Info

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

func (*ClusterPipeline) Keys

func (c *ClusterPipeline) Keys(pattern string) *StringSliceCmd

func (*ClusterPipeline) LIndex

func (c *ClusterPipeline) LIndex(key string, index int64) *StringCmd

func (*ClusterPipeline) LInsert

func (c *ClusterPipeline) LInsert(key, op, pivot, value string) *IntCmd

func (*ClusterPipeline) LLen

func (c *ClusterPipeline) LLen(key string) *IntCmd

func (*ClusterPipeline) LPop

func (c *ClusterPipeline) LPop(key string) *StringCmd

func (*ClusterPipeline) LPush

func (c *ClusterPipeline) LPush(key string, values ...string) *IntCmd

func (*ClusterPipeline) LPushX

func (c *ClusterPipeline) LPushX(key, value interface{}) *IntCmd

func (*ClusterPipeline) LRange

func (c *ClusterPipeline) LRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterPipeline) LRem

func (c *ClusterPipeline) LRem(key string, count int64, value interface{}) *IntCmd

func (*ClusterPipeline) LSet

func (c *ClusterPipeline) LSet(key string, index int64, value interface{}) *StatusCmd

func (*ClusterPipeline) LTrim

func (c *ClusterPipeline) LTrim(key string, start, stop int64) *StatusCmd

func (*ClusterPipeline) LastSave

func (c *ClusterPipeline) LastSave() *IntCmd

func (*ClusterPipeline) MGet

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

func (*ClusterPipeline) MSet

func (c *ClusterPipeline) MSet(pairs ...string) *StatusCmd

func (*ClusterPipeline) MSetNX

func (c *ClusterPipeline) MSetNX(pairs ...string) *BoolCmd

func (*ClusterPipeline) Migrate

func (c *ClusterPipeline) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*ClusterPipeline) Move

func (c *ClusterPipeline) Move(key string, db int64) *BoolCmd

func (*ClusterPipeline) ObjectEncoding

func (c *ClusterPipeline) ObjectEncoding(keys ...string) *StringCmd

func (*ClusterPipeline) ObjectIdleTime

func (c *ClusterPipeline) ObjectIdleTime(keys ...string) *DurationCmd

func (*ClusterPipeline) ObjectRefCount

func (c *ClusterPipeline) ObjectRefCount(keys ...string) *IntCmd

func (*ClusterPipeline) PExpire

func (c *ClusterPipeline) PExpire(key string, expiration time.Duration) *BoolCmd

func (*ClusterPipeline) PExpireAt

func (c *ClusterPipeline) PExpireAt(key string, tm time.Time) *BoolCmd

func (*ClusterPipeline) PFAdd added in v3.2.14

func (c *ClusterPipeline) PFAdd(key string, fields ...string) *IntCmd

func (*ClusterPipeline) PFCount added in v3.2.14

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

func (*ClusterPipeline) PFMerge added in v3.2.14

func (c *ClusterPipeline) PFMerge(dest string, keys ...string) *StatusCmd

func (*ClusterPipeline) PTTL

func (c *ClusterPipeline) PTTL(key string) *DurationCmd

func (*ClusterPipeline) Persist

func (c *ClusterPipeline) Persist(key string) *BoolCmd

func (*ClusterPipeline) Ping

func (c *ClusterPipeline) Ping() *StatusCmd

func (*ClusterPipeline) Process

func (c *ClusterPipeline) Process(cmd Cmder)

func (*ClusterPipeline) PubSubChannels

func (c *ClusterPipeline) PubSubChannels(pattern string) *StringSliceCmd

func (*ClusterPipeline) PubSubNumPat

func (c *ClusterPipeline) PubSubNumPat() *IntCmd

func (*ClusterPipeline) PubSubNumSub

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

func (*ClusterPipeline) Quit

func (c *ClusterPipeline) Quit() *StatusCmd

func (*ClusterPipeline) RPop

func (c *ClusterPipeline) RPop(key string) *StringCmd

func (*ClusterPipeline) RPopLPush

func (c *ClusterPipeline) RPopLPush(source, destination string) *StringCmd

func (*ClusterPipeline) RPush

func (c *ClusterPipeline) RPush(key string, values ...string) *IntCmd

func (*ClusterPipeline) RPushX

func (c *ClusterPipeline) RPushX(key string, value interface{}) *IntCmd

func (*ClusterPipeline) RandomKey

func (c *ClusterPipeline) RandomKey() *StringCmd

func (*ClusterPipeline) ReadWrite added in v3.2.26

func (c *ClusterPipeline) ReadWrite() *StatusCmd

func (*ClusterPipeline) Readonly added in v3.2.26

func (c *ClusterPipeline) Readonly() *StatusCmd

func (*ClusterPipeline) Rename

func (c *ClusterPipeline) Rename(key, newkey string) *StatusCmd

func (*ClusterPipeline) RenameNX

func (c *ClusterPipeline) RenameNX(key, newkey string) *BoolCmd

func (*ClusterPipeline) Restore

func (c *ClusterPipeline) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*ClusterPipeline) RestoreReplace added in v3.2.0

func (c *ClusterPipeline) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*ClusterPipeline) SAdd

func (c *ClusterPipeline) SAdd(key string, members ...string) *IntCmd

func (*ClusterPipeline) SCard

func (c *ClusterPipeline) SCard(key string) *IntCmd

func (*ClusterPipeline) SDiff

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

func (*ClusterPipeline) SDiffStore

func (c *ClusterPipeline) SDiffStore(destination string, keys ...string) *IntCmd

func (*ClusterPipeline) SInter

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

func (*ClusterPipeline) SInterStore

func (c *ClusterPipeline) SInterStore(destination string, keys ...string) *IntCmd

func (*ClusterPipeline) SIsMember

func (c *ClusterPipeline) SIsMember(key string, member interface{}) *BoolCmd

func (*ClusterPipeline) SMembers

func (c *ClusterPipeline) SMembers(key string) *StringSliceCmd

func (*ClusterPipeline) SMove

func (c *ClusterPipeline) SMove(source, destination string, member interface{}) *BoolCmd

func (*ClusterPipeline) SPop

func (c *ClusterPipeline) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*ClusterPipeline) SPopN added in v3.6.3

func (c *ClusterPipeline) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*ClusterPipeline) SRandMember

func (c *ClusterPipeline) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*ClusterPipeline) SRandMemberN added in v3.2.6

func (c *ClusterPipeline) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*ClusterPipeline) SRem

func (c *ClusterPipeline) SRem(key string, members ...string) *IntCmd

func (*ClusterPipeline) SScan

func (c *ClusterPipeline) SScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*ClusterPipeline) SUnion

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

func (*ClusterPipeline) SUnionStore

func (c *ClusterPipeline) SUnionStore(destination string, keys ...string) *IntCmd

func (*ClusterPipeline) Save

func (c *ClusterPipeline) Save() *StatusCmd

func (*ClusterPipeline) Scan

func (c *ClusterPipeline) Scan(cursor int64, match string, count int64) *ScanCmd

func (*ClusterPipeline) ScriptExists

func (c *ClusterPipeline) ScriptExists(scripts ...string) *BoolSliceCmd

func (*ClusterPipeline) ScriptFlush

func (c *ClusterPipeline) ScriptFlush() *StatusCmd

func (*ClusterPipeline) ScriptKill

func (c *ClusterPipeline) ScriptKill() *StatusCmd

func (*ClusterPipeline) ScriptLoad

func (c *ClusterPipeline) ScriptLoad(script string) *StringCmd

func (*ClusterPipeline) Select

func (c *ClusterPipeline) Select(index int64) *StatusCmd

func (*ClusterPipeline) Set

func (c *ClusterPipeline) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Zero expiration means the key has no expiration time.

func (*ClusterPipeline) SetBit

func (c *ClusterPipeline) SetBit(key string, offset int64, value int) *IntCmd

func (*ClusterPipeline) SetNX

func (c *ClusterPipeline) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*ClusterPipeline) SetRange

func (c *ClusterPipeline) SetRange(key string, offset int64, value string) *IntCmd

func (*ClusterPipeline) SetXX added in v3.4.0

func (c *ClusterPipeline) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*ClusterPipeline) Shutdown

func (c *ClusterPipeline) Shutdown() *StatusCmd

func (*ClusterPipeline) ShutdownNoSave

func (c *ClusterPipeline) ShutdownNoSave() *StatusCmd

func (*ClusterPipeline) ShutdownSave

func (c *ClusterPipeline) ShutdownSave() *StatusCmd

func (*ClusterPipeline) SlaveOf

func (c *ClusterPipeline) SlaveOf(host, port string) *StatusCmd

func (*ClusterPipeline) SlowLog

func (c *ClusterPipeline) SlowLog()

func (*ClusterPipeline) Sort

func (c *ClusterPipeline) Sort(key string, sort Sort) *StringSliceCmd

func (*ClusterPipeline) SortInterfaces added in v3.2.28

func (c *ClusterPipeline) SortInterfaces(key string, sort Sort) *SliceCmd

func (*ClusterPipeline) StrLen

func (c *ClusterPipeline) StrLen(key string) *IntCmd

func (*ClusterPipeline) Sync

func (c *ClusterPipeline) Sync()

func (*ClusterPipeline) TTL

func (c *ClusterPipeline) TTL(key string) *DurationCmd

func (*ClusterPipeline) Time

func (c *ClusterPipeline) Time() *StringSliceCmd

func (*ClusterPipeline) Type

func (c *ClusterPipeline) Type(key string) *StatusCmd

func (*ClusterPipeline) ZAdd

func (c *ClusterPipeline) ZAdd(key string, members ...Z) *IntCmd

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

func (*ClusterPipeline) ZAddCh added in v3.2.7

func (c *ClusterPipeline) ZAddCh(key string, members ...Z) *IntCmd

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

func (*ClusterPipeline) ZAddNX added in v3.2.7

func (c *ClusterPipeline) ZAddNX(key string, members ...Z) *IntCmd

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

func (*ClusterPipeline) ZAddNXCh added in v3.2.7

func (c *ClusterPipeline) ZAddNXCh(key string, members ...Z) *IntCmd

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

func (*ClusterPipeline) ZAddXX added in v3.2.7

func (c *ClusterPipeline) ZAddXX(key string, members ...Z) *IntCmd

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

func (*ClusterPipeline) ZAddXXCh added in v3.2.7

func (c *ClusterPipeline) ZAddXXCh(key string, members ...Z) *IntCmd

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

func (*ClusterPipeline) ZCard

func (c *ClusterPipeline) ZCard(key string) *IntCmd

func (*ClusterPipeline) ZCount

func (c *ClusterPipeline) ZCount(key, min, max string) *IntCmd

func (*ClusterPipeline) ZIncr added in v3.2.7

func (c *ClusterPipeline) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*ClusterPipeline) ZIncrBy

func (c *ClusterPipeline) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*ClusterPipeline) ZIncrNX added in v3.2.7

func (c *ClusterPipeline) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*ClusterPipeline) ZIncrXX added in v3.2.7

func (c *ClusterPipeline) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*ClusterPipeline) ZInterStore

func (c *ClusterPipeline) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*ClusterPipeline) ZRange

func (c *ClusterPipeline) ZRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterPipeline) ZRangeByLex added in v3.2.6

func (c *ClusterPipeline) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterPipeline) ZRangeByScore

func (c *ClusterPipeline) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterPipeline) ZRangeByScoreWithScores

func (c *ClusterPipeline) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*ClusterPipeline) ZRangeWithScores

func (c *ClusterPipeline) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*ClusterPipeline) ZRank

func (c *ClusterPipeline) ZRank(key, member string) *IntCmd

func (*ClusterPipeline) ZRem

func (c *ClusterPipeline) ZRem(key string, members ...string) *IntCmd

func (*ClusterPipeline) ZRemRangeByRank

func (c *ClusterPipeline) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*ClusterPipeline) ZRemRangeByScore

func (c *ClusterPipeline) ZRemRangeByScore(key, min, max string) *IntCmd

func (*ClusterPipeline) ZRevRange

func (c *ClusterPipeline) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*ClusterPipeline) ZRevRangeByLex added in v3.2.6

func (c *ClusterPipeline) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterPipeline) ZRevRangeByScore

func (c *ClusterPipeline) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*ClusterPipeline) ZRevRangeByScoreWithScores

func (c *ClusterPipeline) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*ClusterPipeline) ZRevRangeWithScores

func (c *ClusterPipeline) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*ClusterPipeline) ZRevRank

func (c *ClusterPipeline) ZRevRank(key, member string) *IntCmd

func (*ClusterPipeline) ZScan

func (c *ClusterPipeline) ZScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*ClusterPipeline) ZScore

func (c *ClusterPipeline) ZScore(key, member string) *FloatCmd

func (*ClusterPipeline) ZUnionStore

func (c *ClusterPipeline) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type ClusterSlotCmd

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

TODO: rename to ClusterSlotsCmd

func NewClusterSlotCmd

func NewClusterSlotCmd(args ...interface{}) *ClusterSlotCmd

func (*ClusterSlotCmd) Err

func (cmd *ClusterSlotCmd) Err() error

func (*ClusterSlotCmd) Result

func (cmd *ClusterSlotCmd) Result() ([]ClusterSlotInfo, error)

func (*ClusterSlotCmd) String

func (cmd *ClusterSlotCmd) String() string

func (*ClusterSlotCmd) Val

func (cmd *ClusterSlotCmd) Val() []ClusterSlotInfo

type ClusterSlotInfo

type ClusterSlotInfo struct {
	Start int
	End   int
	Addrs []string
}

TODO: rename to ClusterSlot

type Cmd

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

func NewCmd

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

func (*Cmd) Err

func (cmd *Cmd) Err() error

func (*Cmd) Result

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

func (*Cmd) String

func (cmd *Cmd) String() string

func (*Cmd) Val

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

type Cmder

type Cmder interface {
	Err() error
	fmt.Stringer
	// contains filtered or unexported methods
}

type DurationCmd

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

func NewDurationCmd

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

func (*DurationCmd) Err

func (cmd *DurationCmd) Err() error

func (*DurationCmd) Result

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

func (*DurationCmd) String

func (cmd *DurationCmd) String() string

func (*DurationCmd) Val

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

type FailoverOptions

type FailoverOptions struct {
	// The master name.
	MasterName string
	// A seed list of host:port addresses of sentinel nodes.
	SentinelAddrs []string

	Password string
	DB       int64

	MaxRetries int

	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration

	PoolSize           int
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
}

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

type FloatCmd

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

func NewFloatCmd

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

func (*FloatCmd) Err

func (cmd *FloatCmd) Err() error

func (*FloatCmd) Result added in v3.2.7

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

func (*FloatCmd) String

func (cmd *FloatCmd) String() string

func (*FloatCmd) Val

func (cmd *FloatCmd) Val() float64

type GeoLocation added in v3.2.11

type GeoLocation struct {
	Name                      string
	Longitude, Latitude, Dist float64
	GeoHash                   int64
}

GeoLocation is used with GeoAdd to add geospatial location.

type GeoLocationCmd added in v3.2.11

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

func NewGeoLocationCmd added in v3.2.11

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

func (*GeoLocationCmd) Err added in v3.2.11

func (cmd *GeoLocationCmd) Err() error

func (*GeoLocationCmd) Result added in v3.2.11

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

func (*GeoLocationCmd) String added in v3.2.11

func (cmd *GeoLocationCmd) String() string

func (*GeoLocationCmd) Val added in v3.2.11

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

type GeoRadiusQuery added in v3.2.11

type GeoRadiusQuery struct {
	Radius float64
	// Can be m, km, ft, or mi. Default is km.
	Unit        string
	WithCoord   bool
	WithDist    bool
	WithGeoHash bool
	Count       int
	// Can be ASC or DESC. Default is no sort order.
	Sort string
}

GeoRadiusQuery is used with GeoRadius to query geospatial index.

type IntCmd

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

func NewIntCmd

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

func (*IntCmd) Err

func (cmd *IntCmd) Err() error

func (*IntCmd) Result

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

func (*IntCmd) String

func (cmd *IntCmd) String() string

func (*IntCmd) Val

func (cmd *IntCmd) Val() int64

type Message

type Message struct {
	Channel string
	Pattern string
	Payload string
}

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

func (*Message) String

func (m *Message) String() string

type Multi

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

Multi implements Redis transactions as described in http://redis.io/topics/transactions. It's NOT safe for concurrent use by multiple goroutines, because Exec resets list of watched keys. If you don't need WATCH it is better to use Pipeline.

TODO(vmihailenco): rename to Tx and rework API

func (*Multi) Append

func (c *Multi) Append(key, value string) *IntCmd

func (*Multi) Auth

func (c *Multi) Auth(password string) *StatusCmd

func (*Multi) BLPop

func (c *Multi) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Multi) BRPop

func (c *Multi) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Multi) BRPopLPush

func (c *Multi) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Multi) BgRewriteAOF

func (c *Multi) BgRewriteAOF() *StatusCmd

func (*Multi) BgSave

func (c *Multi) BgSave() *StatusCmd

func (*Multi) BitCount

func (c *Multi) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Multi) BitOpAnd

func (c *Multi) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*Multi) BitOpNot

func (c *Multi) BitOpNot(destKey string, key string) *IntCmd

func (*Multi) BitOpOr

func (c *Multi) BitOpOr(destKey string, keys ...string) *IntCmd

func (*Multi) BitOpXor

func (c *Multi) BitOpXor(destKey string, keys ...string) *IntCmd

func (*Multi) BitPos

func (c *Multi) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Multi) ClientKill

func (c *Multi) ClientKill(ipPort string) *StatusCmd

func (*Multi) ClientList

func (c *Multi) ClientList() *StringCmd

func (*Multi) ClientPause

func (c *Multi) ClientPause(dur time.Duration) *BoolCmd

func (*Multi) ClientSetName added in v3.2.13

func (c *Multi) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the one of many connections in the pool.

func (*Multi) Close

func (c *Multi) Close() error

Close closes the client, releasing any open resources.

func (*Multi) ClusterAddSlots

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

func (*Multi) ClusterAddSlotsRange

func (c *Multi) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Multi) ClusterCountFailureReports added in v3.2.26

func (c *Multi) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Multi) ClusterCountKeysInSlot added in v3.2.26

func (c *Multi) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Multi) ClusterDelSlots added in v3.2.26

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

func (*Multi) ClusterDelSlotsRange added in v3.2.26

func (c *Multi) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Multi) ClusterFailover

func (c *Multi) ClusterFailover() *StatusCmd

func (*Multi) ClusterForget added in v3.2.20

func (c *Multi) ClusterForget(nodeID string) *StatusCmd

func (*Multi) ClusterInfo

func (c *Multi) ClusterInfo() *StringCmd

func (*Multi) ClusterKeySlot added in v3.2.26

func (c *Multi) ClusterKeySlot(key string) *IntCmd

func (*Multi) ClusterMeet

func (c *Multi) ClusterMeet(host, port string) *StatusCmd

func (*Multi) ClusterNodes

func (c *Multi) ClusterNodes() *StringCmd

func (*Multi) ClusterReplicate

func (c *Multi) ClusterReplicate(nodeID string) *StatusCmd

func (*Multi) ClusterResetHard added in v3.2.24

func (c *Multi) ClusterResetHard() *StatusCmd

func (*Multi) ClusterResetSoft added in v3.2.24

func (c *Multi) ClusterResetSoft() *StatusCmd

func (*Multi) ClusterSaveConfig added in v3.2.26

func (c *Multi) ClusterSaveConfig() *StatusCmd

func (*Multi) ClusterSlaves added in v3.2.26

func (c *Multi) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Multi) ClusterSlots

func (c *Multi) ClusterSlots() *ClusterSlotCmd

func (*Multi) ConfigGet

func (c *Multi) ConfigGet(parameter string) *SliceCmd

func (*Multi) ConfigResetStat

func (c *Multi) ConfigResetStat() *StatusCmd

func (*Multi) ConfigSet

func (c *Multi) ConfigSet(parameter, value string) *StatusCmd

func (*Multi) DbSize

func (c *Multi) DbSize() *IntCmd

func (*Multi) DebugObject

func (c *Multi) DebugObject(key string) *StringCmd

func (*Multi) Decr

func (c *Multi) Decr(key string) *IntCmd

func (*Multi) DecrBy

func (c *Multi) DecrBy(key string, decrement int64) *IntCmd

func (*Multi) Del

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

func (*Multi) Discard

func (c *Multi) Discard() error

Discard discards queued commands.

func (*Multi) Dump

func (c *Multi) Dump(key string) *StringCmd

func (*Multi) Echo

func (c *Multi) Echo(message string) *StringCmd

func (*Multi) Eval

func (c *Multi) Eval(script string, keys []string, args []string) *Cmd

func (*Multi) EvalSha

func (c *Multi) EvalSha(sha1 string, keys []string, args []string) *Cmd

func (*Multi) Exec

func (c *Multi) Exec(f func() error) ([]Cmder, error)

Exec executes all previously queued commands in a transaction and restores the connection state to normal.

When using WATCH, EXEC will execute commands only if the watched keys were not modified, allowing for a check-and-set mechanism.

Exec always returns list of commands. If transaction fails TxFailedErr is returned. Otherwise Exec returns error of the first failed command or nil.

func (*Multi) Exists

func (c *Multi) Exists(key string) *BoolCmd

func (*Multi) Expire

func (c *Multi) Expire(key string, expiration time.Duration) *BoolCmd

func (*Multi) ExpireAt

func (c *Multi) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Multi) FlushAll

func (c *Multi) FlushAll() *StatusCmd

func (*Multi) FlushDb

func (c *Multi) FlushDb() *StatusCmd

func (*Multi) GeoAdd added in v3.2.11

func (c *Multi) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*Multi) GeoDist added in v3.2.13

func (c *Multi) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Multi) GeoHash added in v3.2.13

func (c *Multi) GeoHash(key string, members ...string) *StringSliceCmd

func (*Multi) GeoRadius added in v3.2.11

func (c *Multi) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Multi) GeoRadiusByMember added in v3.2.13

func (c *Multi) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*Multi) Get

func (c *Multi) Get(key string) *StringCmd

func (*Multi) GetBit

func (c *Multi) GetBit(key string, offset int64) *IntCmd

func (*Multi) GetRange

func (c *Multi) GetRange(key string, start, end int64) *StringCmd

func (*Multi) GetSet

func (c *Multi) GetSet(key string, value interface{}) *StringCmd

func (*Multi) HDel

func (c *Multi) HDel(key string, fields ...string) *IntCmd

func (*Multi) HExists

func (c *Multi) HExists(key, field string) *BoolCmd

func (*Multi) HGet

func (c *Multi) HGet(key, field string) *StringCmd

func (*Multi) HGetAll

func (c *Multi) HGetAll(key string) *StringSliceCmd

func (*Multi) HGetAllMap

func (c *Multi) HGetAllMap(key string) *StringStringMapCmd

func (*Multi) HIncrBy

func (c *Multi) HIncrBy(key, field string, incr int64) *IntCmd

func (*Multi) HIncrByFloat

func (c *Multi) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Multi) HKeys

func (c *Multi) HKeys(key string) *StringSliceCmd

func (*Multi) HLen

func (c *Multi) HLen(key string) *IntCmd

func (*Multi) HMGet

func (c *Multi) HMGet(key string, fields ...string) *SliceCmd

func (*Multi) HMSet

func (c *Multi) HMSet(key, field, value string, pairs ...string) *StatusCmd

func (*Multi) HMSetMap added in v3.6.2

func (c *Multi) HMSetMap(key string, fields map[string]string) *StatusCmd

func (*Multi) HScan

func (c *Multi) HScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Multi) HSet

func (c *Multi) HSet(key, field, value string) *BoolCmd

func (*Multi) HSetNX

func (c *Multi) HSetNX(key, field, value string) *BoolCmd

func (*Multi) HVals

func (c *Multi) HVals(key string) *StringSliceCmd

func (*Multi) Incr

func (c *Multi) Incr(key string) *IntCmd

func (*Multi) IncrBy

func (c *Multi) IncrBy(key string, value int64) *IntCmd

func (*Multi) IncrByFloat

func (c *Multi) IncrByFloat(key string, value float64) *FloatCmd

func (*Multi) Info

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

func (*Multi) Keys

func (c *Multi) Keys(pattern string) *StringSliceCmd

func (*Multi) LIndex

func (c *Multi) LIndex(key string, index int64) *StringCmd

func (*Multi) LInsert

func (c *Multi) LInsert(key, op, pivot, value string) *IntCmd

func (*Multi) LLen

func (c *Multi) LLen(key string) *IntCmd

func (*Multi) LPop

func (c *Multi) LPop(key string) *StringCmd

func (*Multi) LPush

func (c *Multi) LPush(key string, values ...string) *IntCmd

func (*Multi) LPushX

func (c *Multi) LPushX(key, value interface{}) *IntCmd

func (*Multi) LRange

func (c *Multi) LRange(key string, start, stop int64) *StringSliceCmd

func (*Multi) LRem

func (c *Multi) LRem(key string, count int64, value interface{}) *IntCmd

func (*Multi) LSet

func (c *Multi) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Multi) LTrim

func (c *Multi) LTrim(key string, start, stop int64) *StatusCmd

func (*Multi) LastSave

func (c *Multi) LastSave() *IntCmd

func (*Multi) MGet

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

func (*Multi) MSet

func (c *Multi) MSet(pairs ...string) *StatusCmd

func (*Multi) MSetNX

func (c *Multi) MSetNX(pairs ...string) *BoolCmd

func (*Multi) Migrate

func (c *Multi) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Multi) Move

func (c *Multi) Move(key string, db int64) *BoolCmd

func (*Multi) ObjectEncoding

func (c *Multi) ObjectEncoding(keys ...string) *StringCmd

func (*Multi) ObjectIdleTime

func (c *Multi) ObjectIdleTime(keys ...string) *DurationCmd

func (*Multi) ObjectRefCount

func (c *Multi) ObjectRefCount(keys ...string) *IntCmd

func (*Multi) PExpire

func (c *Multi) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Multi) PExpireAt

func (c *Multi) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Multi) PFAdd added in v3.2.14

func (c *Multi) PFAdd(key string, fields ...string) *IntCmd

func (*Multi) PFCount added in v3.2.14

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

func (*Multi) PFMerge added in v3.2.14

func (c *Multi) PFMerge(dest string, keys ...string) *StatusCmd

func (*Multi) PTTL

func (c *Multi) PTTL(key string) *DurationCmd

func (*Multi) Persist

func (c *Multi) Persist(key string) *BoolCmd

func (*Multi) Ping

func (c *Multi) Ping() *StatusCmd

func (*Multi) Process

func (c *Multi) Process(cmd Cmder)

func (*Multi) PubSubChannels

func (c *Multi) PubSubChannels(pattern string) *StringSliceCmd

func (*Multi) PubSubNumPat

func (c *Multi) PubSubNumPat() *IntCmd

func (*Multi) PubSubNumSub

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

func (*Multi) Quit

func (c *Multi) Quit() *StatusCmd

func (*Multi) RPop

func (c *Multi) RPop(key string) *StringCmd

func (*Multi) RPopLPush

func (c *Multi) RPopLPush(source, destination string) *StringCmd

func (*Multi) RPush

func (c *Multi) RPush(key string, values ...string) *IntCmd

func (*Multi) RPushX

func (c *Multi) RPushX(key string, value interface{}) *IntCmd

func (*Multi) RandomKey

func (c *Multi) RandomKey() *StringCmd

func (*Multi) ReadWrite added in v3.2.26

func (c *Multi) ReadWrite() *StatusCmd

func (*Multi) Readonly added in v3.2.26

func (c *Multi) Readonly() *StatusCmd

func (*Multi) Rename

func (c *Multi) Rename(key, newkey string) *StatusCmd

func (*Multi) RenameNX

func (c *Multi) RenameNX(key, newkey string) *BoolCmd

func (*Multi) Restore

func (c *Multi) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Multi) RestoreReplace added in v3.2.0

func (c *Multi) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Multi) SAdd

func (c *Multi) SAdd(key string, members ...string) *IntCmd

func (*Multi) SCard

func (c *Multi) SCard(key string) *IntCmd

func (*Multi) SDiff

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

func (*Multi) SDiffStore

func (c *Multi) SDiffStore(destination string, keys ...string) *IntCmd

func (*Multi) SInter

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

func (*Multi) SInterStore

func (c *Multi) SInterStore(destination string, keys ...string) *IntCmd

func (*Multi) SIsMember

func (c *Multi) SIsMember(key string, member interface{}) *BoolCmd

func (*Multi) SMembers

func (c *Multi) SMembers(key string) *StringSliceCmd

func (*Multi) SMove

func (c *Multi) SMove(source, destination string, member interface{}) *BoolCmd

func (*Multi) SPop

func (c *Multi) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Multi) SPopN added in v3.6.3

func (c *Multi) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Multi) SRandMember

func (c *Multi) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Multi) SRandMemberN added in v3.2.6

func (c *Multi) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Multi) SRem

func (c *Multi) SRem(key string, members ...string) *IntCmd

func (*Multi) SScan

func (c *Multi) SScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Multi) SUnion

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

func (*Multi) SUnionStore

func (c *Multi) SUnionStore(destination string, keys ...string) *IntCmd

func (*Multi) Save

func (c *Multi) Save() *StatusCmd

func (*Multi) Scan

func (c *Multi) Scan(cursor int64, match string, count int64) *ScanCmd

func (*Multi) ScriptExists

func (c *Multi) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Multi) ScriptFlush

func (c *Multi) ScriptFlush() *StatusCmd

func (*Multi) ScriptKill

func (c *Multi) ScriptKill() *StatusCmd

func (*Multi) ScriptLoad

func (c *Multi) ScriptLoad(script string) *StringCmd

func (*Multi) Select

func (c *Multi) Select(index int64) *StatusCmd

func (*Multi) Set

func (c *Multi) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Zero expiration means the key has no expiration time.

func (*Multi) SetBit

func (c *Multi) SetBit(key string, offset int64, value int) *IntCmd

func (*Multi) SetNX

func (c *Multi) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Multi) SetRange

func (c *Multi) SetRange(key string, offset int64, value string) *IntCmd

func (*Multi) SetXX added in v3.4.0

func (c *Multi) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Multi) Shutdown

func (c *Multi) Shutdown() *StatusCmd

func (*Multi) ShutdownNoSave

func (c *Multi) ShutdownNoSave() *StatusCmd

func (*Multi) ShutdownSave

func (c *Multi) ShutdownSave() *StatusCmd

func (*Multi) SlaveOf

func (c *Multi) SlaveOf(host, port string) *StatusCmd

func (*Multi) SlowLog

func (c *Multi) SlowLog()

func (*Multi) Sort

func (c *Multi) Sort(key string, sort Sort) *StringSliceCmd

func (*Multi) SortInterfaces added in v3.2.28

func (c *Multi) SortInterfaces(key string, sort Sort) *SliceCmd

func (*Multi) StrLen

func (c *Multi) StrLen(key string) *IntCmd

func (*Multi) Sync

func (c *Multi) Sync()

func (*Multi) TTL

func (c *Multi) TTL(key string) *DurationCmd

func (*Multi) Time

func (c *Multi) Time() *StringSliceCmd

func (*Multi) Type

func (c *Multi) Type(key string) *StatusCmd

func (*Multi) Unwatch

func (c *Multi) Unwatch(keys ...string) *StatusCmd

Unwatch flushes all the previously watched keys for a transaction.

func (*Multi) Watch

func (c *Multi) Watch(keys ...string) *StatusCmd

Watch marks the keys to be watched for conditional execution of a transaction.

func (*Multi) ZAdd

func (c *Multi) ZAdd(key string, members ...Z) *IntCmd

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

func (*Multi) ZAddCh added in v3.2.7

func (c *Multi) ZAddCh(key string, members ...Z) *IntCmd

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

func (*Multi) ZAddNX added in v3.2.7

func (c *Multi) ZAddNX(key string, members ...Z) *IntCmd

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

func (*Multi) ZAddNXCh added in v3.2.7

func (c *Multi) ZAddNXCh(key string, members ...Z) *IntCmd

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

func (*Multi) ZAddXX added in v3.2.7

func (c *Multi) ZAddXX(key string, members ...Z) *IntCmd

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

func (*Multi) ZAddXXCh added in v3.2.7

func (c *Multi) ZAddXXCh(key string, members ...Z) *IntCmd

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

func (*Multi) ZCard

func (c *Multi) ZCard(key string) *IntCmd

func (*Multi) ZCount

func (c *Multi) ZCount(key, min, max string) *IntCmd

func (*Multi) ZIncr added in v3.2.7

func (c *Multi) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Multi) ZIncrBy

func (c *Multi) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*Multi) ZIncrNX added in v3.2.7

func (c *Multi) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Multi) ZIncrXX added in v3.2.7

func (c *Multi) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Multi) ZInterStore

func (c *Multi) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*Multi) ZRange

func (c *Multi) ZRange(key string, start, stop int64) *StringSliceCmd

func (*Multi) ZRangeByLex added in v3.2.6

func (c *Multi) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Multi) ZRangeByScore

func (c *Multi) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Multi) ZRangeByScoreWithScores

func (c *Multi) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Multi) ZRangeWithScores

func (c *Multi) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Multi) ZRank

func (c *Multi) ZRank(key, member string) *IntCmd

func (*Multi) ZRem

func (c *Multi) ZRem(key string, members ...string) *IntCmd

func (*Multi) ZRemRangeByRank

func (c *Multi) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*Multi) ZRemRangeByScore

func (c *Multi) ZRemRangeByScore(key, min, max string) *IntCmd

func (*Multi) ZRevRange

func (c *Multi) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*Multi) ZRevRangeByLex added in v3.2.6

func (c *Multi) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Multi) ZRevRangeByScore

func (c *Multi) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Multi) ZRevRangeByScoreWithScores

func (c *Multi) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Multi) ZRevRangeWithScores

func (c *Multi) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Multi) ZRevRank

func (c *Multi) ZRevRank(key, member string) *IntCmd

func (*Multi) ZScan

func (c *Multi) ZScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Multi) ZScore

func (c *Multi) ZScore(key, member string) *FloatCmd

func (*Multi) ZUnionStore

func (c *Multi) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type Options

type Options struct {
	// The network type, either tcp or unix.
	// Default is tcp.
	Network string
	// host:port address.
	Addr string

	// Dialer creates new network connection and has priority over
	// Network and Addr options.
	Dialer func() (net.Conn, error)

	// An optional password. Must match the password specified in the
	// requirepass server configuration option.
	Password string
	// A database to be selected after connecting to server.
	DB int64

	// The maximum number of retries before giving up.
	// Default is to not retry failed commands.
	MaxRetries int

	// Sets the deadline for establishing new connections. If reached,
	// dial will fail with a timeout.
	// Default is 5 seconds.
	DialTimeout time.Duration
	// Sets the deadline for socket reads. If reached, commands will
	// fail with a timeout instead of blocking.
	ReadTimeout time.Duration
	// Sets the deadline for socket writes. If reached, commands will
	// fail with a timeout instead of blocking.
	WriteTimeout time.Duration

	// The maximum number of socket connections.
	// Default is 10 connections.
	PoolSize int
	// Specifies amount of time client waits for connection if all
	// connections are busy before returning an error.
	// Default is 1 second.
	PoolTimeout time.Duration
	// Specifies amount of time after which client closes idle
	// connections. Should be less than server's timeout.
	// Default is to not close idle connections.
	IdleTimeout time.Duration
	// The frequency of idle checks.
	// Default is 1 minute.
	IdleCheckFrequency time.Duration
}

type PMessage

type PMessage struct {
	Channel string
	Pattern string
	Payload string
}

Message matching a pattern-matching subscription received as result of a PUBLISH command issued by another client.

func (*PMessage) String

func (m *PMessage) String() string

type Pipeline

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

Pipeline implements pipelining as described in http://redis.io/topics/pipelining. It's safe for concurrent use by multiple goroutines.

Example
pipe := client.Pipeline()
defer pipe.Close()

incr := pipe.Incr("counter2")
pipe.Expire("counter2", time.Hour)
_, err := pipe.Exec()
fmt.Println(incr.Val(), err)
Output:

1 <nil>

func (*Pipeline) Append

func (c *Pipeline) Append(key, value string) *IntCmd

func (*Pipeline) Auth

func (c *Pipeline) Auth(password string) *StatusCmd

func (*Pipeline) BLPop

func (c *Pipeline) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Pipeline) BRPop

func (c *Pipeline) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*Pipeline) BRPopLPush

func (c *Pipeline) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Pipeline) BgRewriteAOF

func (c *Pipeline) BgRewriteAOF() *StatusCmd

func (*Pipeline) BgSave

func (c *Pipeline) BgSave() *StatusCmd

func (*Pipeline) BitCount

func (c *Pipeline) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Pipeline) BitOpAnd

func (c *Pipeline) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*Pipeline) BitOpNot

func (c *Pipeline) BitOpNot(destKey string, key string) *IntCmd

func (*Pipeline) BitOpOr

func (c *Pipeline) BitOpOr(destKey string, keys ...string) *IntCmd

func (*Pipeline) BitOpXor

func (c *Pipeline) BitOpXor(destKey string, keys ...string) *IntCmd

func (*Pipeline) BitPos

func (c *Pipeline) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Pipeline) ClientKill

func (c *Pipeline) ClientKill(ipPort string) *StatusCmd

func (*Pipeline) ClientList

func (c *Pipeline) ClientList() *StringCmd

func (*Pipeline) ClientPause

func (c *Pipeline) ClientPause(dur time.Duration) *BoolCmd

func (*Pipeline) ClientSetName added in v3.2.13

func (c *Pipeline) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the one of many connections in the pool.

func (*Pipeline) Close

func (pipe *Pipeline) Close() error

Close closes the pipeline, releasing any open resources.

func (*Pipeline) ClusterAddSlots

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

func (*Pipeline) ClusterAddSlotsRange

func (c *Pipeline) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Pipeline) ClusterCountFailureReports added in v3.2.26

func (c *Pipeline) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Pipeline) ClusterCountKeysInSlot added in v3.2.26

func (c *Pipeline) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Pipeline) ClusterDelSlots added in v3.2.26

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

func (*Pipeline) ClusterDelSlotsRange added in v3.2.26

func (c *Pipeline) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Pipeline) ClusterFailover

func (c *Pipeline) ClusterFailover() *StatusCmd

func (*Pipeline) ClusterForget added in v3.2.20

func (c *Pipeline) ClusterForget(nodeID string) *StatusCmd

func (*Pipeline) ClusterInfo

func (c *Pipeline) ClusterInfo() *StringCmd

func (*Pipeline) ClusterKeySlot added in v3.2.26

func (c *Pipeline) ClusterKeySlot(key string) *IntCmd

func (*Pipeline) ClusterMeet

func (c *Pipeline) ClusterMeet(host, port string) *StatusCmd

func (*Pipeline) ClusterNodes

func (c *Pipeline) ClusterNodes() *StringCmd

func (*Pipeline) ClusterReplicate

func (c *Pipeline) ClusterReplicate(nodeID string) *StatusCmd

func (*Pipeline) ClusterResetHard added in v3.2.24

func (c *Pipeline) ClusterResetHard() *StatusCmd

func (*Pipeline) ClusterResetSoft added in v3.2.24

func (c *Pipeline) ClusterResetSoft() *StatusCmd

func (*Pipeline) ClusterSaveConfig added in v3.2.26

func (c *Pipeline) ClusterSaveConfig() *StatusCmd

func (*Pipeline) ClusterSlaves added in v3.2.26

func (c *Pipeline) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Pipeline) ClusterSlots

func (c *Pipeline) ClusterSlots() *ClusterSlotCmd

func (*Pipeline) ConfigGet

func (c *Pipeline) ConfigGet(parameter string) *SliceCmd

func (*Pipeline) ConfigResetStat

func (c *Pipeline) ConfigResetStat() *StatusCmd

func (*Pipeline) ConfigSet

func (c *Pipeline) ConfigSet(parameter, value string) *StatusCmd

func (*Pipeline) DbSize

func (c *Pipeline) DbSize() *IntCmd

func (*Pipeline) DebugObject

func (c *Pipeline) DebugObject(key string) *StringCmd

func (*Pipeline) Decr

func (c *Pipeline) Decr(key string) *IntCmd

func (*Pipeline) DecrBy

func (c *Pipeline) DecrBy(key string, decrement int64) *IntCmd

func (*Pipeline) Del

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

func (*Pipeline) Discard

func (pipe *Pipeline) Discard() error

Discard resets the pipeline and discards queued commands.

func (*Pipeline) Dump

func (c *Pipeline) Dump(key string) *StringCmd

func (*Pipeline) Echo

func (c *Pipeline) Echo(message string) *StringCmd

func (*Pipeline) Eval

func (c *Pipeline) Eval(script string, keys []string, args []string) *Cmd

func (*Pipeline) EvalSha

func (c *Pipeline) EvalSha(sha1 string, keys []string, args []string) *Cmd

func (*Pipeline) Exec

func (pipe *Pipeline) Exec() (cmds []Cmder, retErr error)

Exec executes all previously queued commands using one client-server roundtrip.

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

func (*Pipeline) Exists

func (c *Pipeline) Exists(key string) *BoolCmd

func (*Pipeline) Expire

func (c *Pipeline) Expire(key string, expiration time.Duration) *BoolCmd

func (*Pipeline) ExpireAt

func (c *Pipeline) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Pipeline) FlushAll

func (c *Pipeline) FlushAll() *StatusCmd

func (*Pipeline) FlushDb

func (c *Pipeline) FlushDb() *StatusCmd

func (*Pipeline) GeoAdd added in v3.2.11

func (c *Pipeline) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*Pipeline) GeoDist added in v3.2.13

func (c *Pipeline) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Pipeline) GeoHash added in v3.2.13

func (c *Pipeline) GeoHash(key string, members ...string) *StringSliceCmd

func (*Pipeline) GeoRadius added in v3.2.11

func (c *Pipeline) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Pipeline) GeoRadiusByMember added in v3.2.13

func (c *Pipeline) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*Pipeline) Get

func (c *Pipeline) Get(key string) *StringCmd

func (*Pipeline) GetBit

func (c *Pipeline) GetBit(key string, offset int64) *IntCmd

func (*Pipeline) GetRange

func (c *Pipeline) GetRange(key string, start, end int64) *StringCmd

func (*Pipeline) GetSet

func (c *Pipeline) GetSet(key string, value interface{}) *StringCmd

func (*Pipeline) HDel

func (c *Pipeline) HDel(key string, fields ...string) *IntCmd

func (*Pipeline) HExists

func (c *Pipeline) HExists(key, field string) *BoolCmd

func (*Pipeline) HGet

func (c *Pipeline) HGet(key, field string) *StringCmd

func (*Pipeline) HGetAll

func (c *Pipeline) HGetAll(key string) *StringSliceCmd

func (*Pipeline) HGetAllMap

func (c *Pipeline) HGetAllMap(key string) *StringStringMapCmd

func (*Pipeline) HIncrBy

func (c *Pipeline) HIncrBy(key, field string, incr int64) *IntCmd

func (*Pipeline) HIncrByFloat

func (c *Pipeline) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Pipeline) HKeys

func (c *Pipeline) HKeys(key string) *StringSliceCmd

func (*Pipeline) HLen

func (c *Pipeline) HLen(key string) *IntCmd

func (*Pipeline) HMGet

func (c *Pipeline) HMGet(key string, fields ...string) *SliceCmd

func (*Pipeline) HMSet

func (c *Pipeline) HMSet(key, field, value string, pairs ...string) *StatusCmd

func (*Pipeline) HMSetMap added in v3.6.2

func (c *Pipeline) HMSetMap(key string, fields map[string]string) *StatusCmd

func (*Pipeline) HScan

func (c *Pipeline) HScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Pipeline) HSet

func (c *Pipeline) HSet(key, field, value string) *BoolCmd

func (*Pipeline) HSetNX

func (c *Pipeline) HSetNX(key, field, value string) *BoolCmd

func (*Pipeline) HVals

func (c *Pipeline) HVals(key string) *StringSliceCmd

func (*Pipeline) Incr

func (c *Pipeline) Incr(key string) *IntCmd

func (*Pipeline) IncrBy

func (c *Pipeline) IncrBy(key string, value int64) *IntCmd

func (*Pipeline) IncrByFloat

func (c *Pipeline) IncrByFloat(key string, value float64) *FloatCmd

func (*Pipeline) Info

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

func (*Pipeline) Keys

func (c *Pipeline) Keys(pattern string) *StringSliceCmd

func (*Pipeline) LIndex

func (c *Pipeline) LIndex(key string, index int64) *StringCmd

func (*Pipeline) LInsert

func (c *Pipeline) LInsert(key, op, pivot, value string) *IntCmd

func (*Pipeline) LLen

func (c *Pipeline) LLen(key string) *IntCmd

func (*Pipeline) LPop

func (c *Pipeline) LPop(key string) *StringCmd

func (*Pipeline) LPush

func (c *Pipeline) LPush(key string, values ...string) *IntCmd

func (*Pipeline) LPushX

func (c *Pipeline) LPushX(key, value interface{}) *IntCmd

func (*Pipeline) LRange

func (c *Pipeline) LRange(key string, start, stop int64) *StringSliceCmd

func (*Pipeline) LRem

func (c *Pipeline) LRem(key string, count int64, value interface{}) *IntCmd

func (*Pipeline) LSet

func (c *Pipeline) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Pipeline) LTrim

func (c *Pipeline) LTrim(key string, start, stop int64) *StatusCmd

func (*Pipeline) LastSave

func (c *Pipeline) LastSave() *IntCmd

func (*Pipeline) MGet

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

func (*Pipeline) MSet

func (c *Pipeline) MSet(pairs ...string) *StatusCmd

func (*Pipeline) MSetNX

func (c *Pipeline) MSetNX(pairs ...string) *BoolCmd

func (*Pipeline) Migrate

func (c *Pipeline) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Pipeline) Move

func (c *Pipeline) Move(key string, db int64) *BoolCmd

func (*Pipeline) ObjectEncoding

func (c *Pipeline) ObjectEncoding(keys ...string) *StringCmd

func (*Pipeline) ObjectIdleTime

func (c *Pipeline) ObjectIdleTime(keys ...string) *DurationCmd

func (*Pipeline) ObjectRefCount

func (c *Pipeline) ObjectRefCount(keys ...string) *IntCmd

func (*Pipeline) PExpire

func (c *Pipeline) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Pipeline) PExpireAt

func (c *Pipeline) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Pipeline) PFAdd added in v3.2.14

func (c *Pipeline) PFAdd(key string, fields ...string) *IntCmd

func (*Pipeline) PFCount added in v3.2.14

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

func (*Pipeline) PFMerge added in v3.2.14

func (c *Pipeline) PFMerge(dest string, keys ...string) *StatusCmd

func (*Pipeline) PTTL

func (c *Pipeline) PTTL(key string) *DurationCmd

func (*Pipeline) Persist

func (c *Pipeline) Persist(key string) *BoolCmd

func (*Pipeline) Ping

func (c *Pipeline) Ping() *StatusCmd

func (*Pipeline) Process

func (c *Pipeline) Process(cmd Cmder)

func (*Pipeline) PubSubChannels

func (c *Pipeline) PubSubChannels(pattern string) *StringSliceCmd

func (*Pipeline) PubSubNumPat

func (c *Pipeline) PubSubNumPat() *IntCmd

func (*Pipeline) PubSubNumSub

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

func (*Pipeline) Quit

func (c *Pipeline) Quit() *StatusCmd

func (*Pipeline) RPop

func (c *Pipeline) RPop(key string) *StringCmd

func (*Pipeline) RPopLPush

func (c *Pipeline) RPopLPush(source, destination string) *StringCmd

func (*Pipeline) RPush

func (c *Pipeline) RPush(key string, values ...string) *IntCmd

func (*Pipeline) RPushX

func (c *Pipeline) RPushX(key string, value interface{}) *IntCmd

func (*Pipeline) RandomKey

func (c *Pipeline) RandomKey() *StringCmd

func (*Pipeline) ReadWrite added in v3.2.26

func (c *Pipeline) ReadWrite() *StatusCmd

func (*Pipeline) Readonly added in v3.2.26

func (c *Pipeline) Readonly() *StatusCmd

func (*Pipeline) Rename

func (c *Pipeline) Rename(key, newkey string) *StatusCmd

func (*Pipeline) RenameNX

func (c *Pipeline) RenameNX(key, newkey string) *BoolCmd

func (*Pipeline) Restore

func (c *Pipeline) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Pipeline) RestoreReplace added in v3.2.0

func (c *Pipeline) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Pipeline) SAdd

func (c *Pipeline) SAdd(key string, members ...string) *IntCmd

func (*Pipeline) SCard

func (c *Pipeline) SCard(key string) *IntCmd

func (*Pipeline) SDiff

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

func (*Pipeline) SDiffStore

func (c *Pipeline) SDiffStore(destination string, keys ...string) *IntCmd

func (*Pipeline) SInter

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

func (*Pipeline) SInterStore

func (c *Pipeline) SInterStore(destination string, keys ...string) *IntCmd

func (*Pipeline) SIsMember

func (c *Pipeline) SIsMember(key string, member interface{}) *BoolCmd

func (*Pipeline) SMembers

func (c *Pipeline) SMembers(key string) *StringSliceCmd

func (*Pipeline) SMove

func (c *Pipeline) SMove(source, destination string, member interface{}) *BoolCmd

func (*Pipeline) SPop

func (c *Pipeline) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Pipeline) SPopN added in v3.6.3

func (c *Pipeline) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Pipeline) SRandMember

func (c *Pipeline) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Pipeline) SRandMemberN added in v3.2.6

func (c *Pipeline) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Pipeline) SRem

func (c *Pipeline) SRem(key string, members ...string) *IntCmd

func (*Pipeline) SScan

func (c *Pipeline) SScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Pipeline) SUnion

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

func (*Pipeline) SUnionStore

func (c *Pipeline) SUnionStore(destination string, keys ...string) *IntCmd

func (*Pipeline) Save

func (c *Pipeline) Save() *StatusCmd

func (*Pipeline) Scan

func (c *Pipeline) Scan(cursor int64, match string, count int64) *ScanCmd

func (*Pipeline) ScriptExists

func (c *Pipeline) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Pipeline) ScriptFlush

func (c *Pipeline) ScriptFlush() *StatusCmd

func (*Pipeline) ScriptKill

func (c *Pipeline) ScriptKill() *StatusCmd

func (*Pipeline) ScriptLoad

func (c *Pipeline) ScriptLoad(script string) *StringCmd

func (*Pipeline) Select

func (c *Pipeline) Select(index int64) *StatusCmd

func (*Pipeline) Set

func (c *Pipeline) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Zero expiration means the key has no expiration time.

func (*Pipeline) SetBit

func (c *Pipeline) SetBit(key string, offset int64, value int) *IntCmd

func (*Pipeline) SetNX

func (c *Pipeline) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Pipeline) SetRange

func (c *Pipeline) SetRange(key string, offset int64, value string) *IntCmd

func (*Pipeline) SetXX added in v3.4.0

func (c *Pipeline) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Pipeline) Shutdown

func (c *Pipeline) Shutdown() *StatusCmd

func (*Pipeline) ShutdownNoSave

func (c *Pipeline) ShutdownNoSave() *StatusCmd

func (*Pipeline) ShutdownSave

func (c *Pipeline) ShutdownSave() *StatusCmd

func (*Pipeline) SlaveOf

func (c *Pipeline) SlaveOf(host, port string) *StatusCmd

func (*Pipeline) SlowLog

func (c *Pipeline) SlowLog()

func (*Pipeline) Sort

func (c *Pipeline) Sort(key string, sort Sort) *StringSliceCmd

func (*Pipeline) SortInterfaces added in v3.2.28

func (c *Pipeline) SortInterfaces(key string, sort Sort) *SliceCmd

func (*Pipeline) StrLen

func (c *Pipeline) StrLen(key string) *IntCmd

func (*Pipeline) Sync

func (c *Pipeline) Sync()

func (*Pipeline) TTL

func (c *Pipeline) TTL(key string) *DurationCmd

func (*Pipeline) Time

func (c *Pipeline) Time() *StringSliceCmd

func (*Pipeline) Type

func (c *Pipeline) Type(key string) *StatusCmd

func (*Pipeline) ZAdd

func (c *Pipeline) ZAdd(key string, members ...Z) *IntCmd

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

func (*Pipeline) ZAddCh added in v3.2.7

func (c *Pipeline) ZAddCh(key string, members ...Z) *IntCmd

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

func (*Pipeline) ZAddNX added in v3.2.7

func (c *Pipeline) ZAddNX(key string, members ...Z) *IntCmd

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

func (*Pipeline) ZAddNXCh added in v3.2.7

func (c *Pipeline) ZAddNXCh(key string, members ...Z) *IntCmd

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

func (*Pipeline) ZAddXX added in v3.2.7

func (c *Pipeline) ZAddXX(key string, members ...Z) *IntCmd

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

func (*Pipeline) ZAddXXCh added in v3.2.7

func (c *Pipeline) ZAddXXCh(key string, members ...Z) *IntCmd

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

func (*Pipeline) ZCard

func (c *Pipeline) ZCard(key string) *IntCmd

func (*Pipeline) ZCount

func (c *Pipeline) ZCount(key, min, max string) *IntCmd

func (*Pipeline) ZIncr added in v3.2.7

func (c *Pipeline) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Pipeline) ZIncrBy

func (c *Pipeline) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*Pipeline) ZIncrNX added in v3.2.7

func (c *Pipeline) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Pipeline) ZIncrXX added in v3.2.7

func (c *Pipeline) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Pipeline) ZInterStore

func (c *Pipeline) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*Pipeline) ZRange

func (c *Pipeline) ZRange(key string, start, stop int64) *StringSliceCmd

func (*Pipeline) ZRangeByLex added in v3.2.6

func (c *Pipeline) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Pipeline) ZRangeByScore

func (c *Pipeline) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Pipeline) ZRangeByScoreWithScores

func (c *Pipeline) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Pipeline) ZRangeWithScores

func (c *Pipeline) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Pipeline) ZRank

func (c *Pipeline) ZRank(key, member string) *IntCmd

func (*Pipeline) ZRem

func (c *Pipeline) ZRem(key string, members ...string) *IntCmd

func (*Pipeline) ZRemRangeByRank

func (c *Pipeline) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*Pipeline) ZRemRangeByScore

func (c *Pipeline) ZRemRangeByScore(key, min, max string) *IntCmd

func (*Pipeline) ZRevRange

func (c *Pipeline) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*Pipeline) ZRevRangeByLex added in v3.2.6

func (c *Pipeline) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Pipeline) ZRevRangeByScore

func (c *Pipeline) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Pipeline) ZRevRangeByScoreWithScores

func (c *Pipeline) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Pipeline) ZRevRangeWithScores

func (c *Pipeline) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Pipeline) ZRevRank

func (c *Pipeline) ZRevRank(key, member string) *IntCmd

func (*Pipeline) ZScan

func (c *Pipeline) ZScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Pipeline) ZScore

func (c *Pipeline) ZScore(key, member string) *FloatCmd

func (*Pipeline) ZUnionStore

func (c *Pipeline) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type Pong added in v3.2.0

type Pong struct {
	Payload string
}

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

func (*Pong) String added in v3.2.0

func (p *Pong) String() string

type PoolStats added in v3.2.29

type PoolStats struct {
	Requests uint32 // number of times a connection was requested by the pool
	Hits     uint32 // number of times free connection was found in the pool
	Waits    uint32 // number of times the pool had to wait for a connection
	Timeouts uint32 // number of times a wait timeout occurred

	TotalConns uint32 // the number of total connections in the pool
	FreeConns  uint32 // the number of free connections in the pool
}

PoolStats contains pool state information and accumulated stats.

type PubSub

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

PubSub implements Pub/Sub commands as described in http://redis.io/topics/pubsub. It's NOT safe for concurrent use by multiple goroutines.

Example
pubsub, err := client.Subscribe("mychannel1")
if err != nil {
	panic(err)
}
defer pubsub.Close()

err = client.Publish("mychannel1", "hello").Err()
if err != nil {
	panic(err)
}

msg, err := pubsub.ReceiveMessage()
if err != nil {
	panic(err)
}

fmt.Println(msg.Channel, msg.Payload)
Output:

mychannel1 hello

func (*PubSub) Close

func (c *PubSub) Close() error

func (*PubSub) PSubscribe

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

Subscribes the client to the given patterns.

func (*PubSub) PUnsubscribe

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

Unsubscribes the client from the given patterns, or from all of them if none is given.

func (*PubSub) Ping added in v3.2.0

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

func (*PubSub) Receive

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

Receive returns a message as a Subscription, Message, PMessage, Pong or error. See PubSub example for details. This is low-level API and most clients should use ReceiveMessage.

Example
pubsub, err := client.Subscribe("mychannel2")
if err != nil {
	panic(err)
}
defer pubsub.Close()

n, err := client.Publish("mychannel2", "hello").Result()
if err != nil {
	panic(err)
}
fmt.Println(n, "clients received message")

for i := 0; i < 2; i++ {
	// ReceiveTimeout is a low level API. Use ReceiveMessage instead.
	msgi, err := pubsub.ReceiveTimeout(5 * time.Second)
	if err != nil {
		break
	}

	switch msg := msgi.(type) {
	case *redis.Subscription:
		fmt.Println("subscribed to", msg.Channel)
	case *redis.Message:
		fmt.Println("received", msg.Payload, "from", msg.Channel)
	default:
		panic(fmt.Errorf("unknown message: %#v", msgi))
	}
}
Output:

1 clients received message
subscribed to mychannel2
received hello from mychannel2

func (*PubSub) ReceiveMessage added in v3.2.9

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

ReceiveMessage returns a Message or error ignoring Subscription or Pong messages. It automatically reconnects to Redis Server and resubscribes to channels in case of network errors.

func (*PubSub) ReceiveTimeout

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

ReceiveTimeout acts like Receive but returns an error if message is not received in time. This is low-level API and most clients should use ReceiveMessage.

func (*PubSub) Subscribe

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

Subscribes the client to the specified channels.

func (*PubSub) Unsubscribe

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

Unsubscribes the client from the given channels, or from all of them if none is given.

type Ring added in v3.1.0

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

Ring is a Redis client that uses constistent hashing to distribute keys across multiple Redis servers (shards). It's safe for concurrent use by multiple goroutines.

Ring monitors the state of each shard and removes dead shards from the ring. When shard comes online it is added back to the ring. This gives you maximum availability and partition tolerance, but no consistency between different shards or even clients. Each client uses shards that are available to the client and does not do any coordination when shard state is changed.

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

func NewRing added in v3.1.0

func NewRing(opt *RingOptions) *Ring
Example
client := redis.NewRing(&redis.RingOptions{
	Addrs: map[string]string{
		"shard1": ":7000",
		"shard2": ":7001",
		"shard3": ":7002",
	},
})
client.Ping()
Output:

func (*Ring) Append added in v3.1.0

func (c *Ring) Append(key, value string) *IntCmd

func (*Ring) Auth added in v3.1.0

func (c *Ring) Auth(password string) *StatusCmd

func (*Ring) BLPop added in v3.1.0

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

func (*Ring) BRPop added in v3.1.0

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

func (*Ring) BRPopLPush added in v3.1.0

func (c *Ring) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*Ring) BgRewriteAOF added in v3.1.0

func (c *Ring) BgRewriteAOF() *StatusCmd

func (*Ring) BgSave added in v3.1.0

func (c *Ring) BgSave() *StatusCmd

func (*Ring) BitCount added in v3.1.0

func (c *Ring) BitCount(key string, bitCount *BitCount) *IntCmd

func (*Ring) BitOpAnd added in v3.1.0

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

func (*Ring) BitOpNot added in v3.1.0

func (c *Ring) BitOpNot(destKey string, key string) *IntCmd

func (*Ring) BitOpOr added in v3.1.0

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

func (*Ring) BitOpXor added in v3.1.0

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

func (*Ring) BitPos added in v3.1.0

func (c *Ring) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*Ring) ClientKill added in v3.1.0

func (c *Ring) ClientKill(ipPort string) *StatusCmd

func (*Ring) ClientList added in v3.1.0

func (c *Ring) ClientList() *StringCmd

func (*Ring) ClientPause added in v3.1.0

func (c *Ring) ClientPause(dur time.Duration) *BoolCmd

func (*Ring) ClientSetName added in v3.2.13

func (c *Ring) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the one of many connections in the pool.

func (*Ring) Close added in v3.1.0

func (ring *Ring) Close() (retErr 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-lived and shared between many goroutines.

func (*Ring) ClusterAddSlots added in v3.1.0

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

func (*Ring) ClusterAddSlotsRange added in v3.1.0

func (c *Ring) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*Ring) ClusterCountFailureReports added in v3.2.26

func (c *Ring) ClusterCountFailureReports(nodeID string) *IntCmd

func (*Ring) ClusterCountKeysInSlot added in v3.2.26

func (c *Ring) ClusterCountKeysInSlot(slot int) *IntCmd

func (*Ring) ClusterDelSlots added in v3.2.26

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

func (*Ring) ClusterDelSlotsRange added in v3.2.26

func (c *Ring) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*Ring) ClusterFailover added in v3.1.0

func (c *Ring) ClusterFailover() *StatusCmd

func (*Ring) ClusterForget added in v3.2.20

func (c *Ring) ClusterForget(nodeID string) *StatusCmd

func (*Ring) ClusterInfo added in v3.1.0

func (c *Ring) ClusterInfo() *StringCmd

func (*Ring) ClusterKeySlot added in v3.2.26

func (c *Ring) ClusterKeySlot(key string) *IntCmd

func (*Ring) ClusterMeet added in v3.1.0

func (c *Ring) ClusterMeet(host, port string) *StatusCmd

func (*Ring) ClusterNodes added in v3.1.0

func (c *Ring) ClusterNodes() *StringCmd

func (*Ring) ClusterReplicate added in v3.1.0

func (c *Ring) ClusterReplicate(nodeID string) *StatusCmd

func (*Ring) ClusterResetHard added in v3.2.24

func (c *Ring) ClusterResetHard() *StatusCmd

func (*Ring) ClusterResetSoft added in v3.2.24

func (c *Ring) ClusterResetSoft() *StatusCmd

func (*Ring) ClusterSaveConfig added in v3.2.26

func (c *Ring) ClusterSaveConfig() *StatusCmd

func (*Ring) ClusterSlaves added in v3.2.26

func (c *Ring) ClusterSlaves(nodeID string) *StringSliceCmd

func (*Ring) ClusterSlots added in v3.1.0

func (c *Ring) ClusterSlots() *ClusterSlotCmd

func (*Ring) ConfigGet added in v3.1.0

func (c *Ring) ConfigGet(parameter string) *SliceCmd

func (*Ring) ConfigResetStat added in v3.1.0

func (c *Ring) ConfigResetStat() *StatusCmd

func (*Ring) ConfigSet added in v3.1.0

func (c *Ring) ConfigSet(parameter, value string) *StatusCmd

func (*Ring) DbSize added in v3.1.0

func (c *Ring) DbSize() *IntCmd

func (*Ring) DebugObject added in v3.1.0

func (c *Ring) DebugObject(key string) *StringCmd

func (*Ring) Decr added in v3.1.0

func (c *Ring) Decr(key string) *IntCmd

func (*Ring) DecrBy added in v3.1.0

func (c *Ring) DecrBy(key string, decrement int64) *IntCmd

func (*Ring) Del added in v3.1.0

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

func (*Ring) Dump added in v3.1.0

func (c *Ring) Dump(key string) *StringCmd

func (*Ring) Echo added in v3.1.0

func (c *Ring) Echo(message string) *StringCmd

func (*Ring) Eval added in v3.1.0

func (c *Ring) Eval(script string, keys []string, args []string) *Cmd

func (*Ring) EvalSha added in v3.1.0

func (c *Ring) EvalSha(sha1 string, keys []string, args []string) *Cmd

func (*Ring) Exists added in v3.1.0

func (c *Ring) Exists(key string) *BoolCmd

func (*Ring) Expire added in v3.1.0

func (c *Ring) Expire(key string, expiration time.Duration) *BoolCmd

func (*Ring) ExpireAt added in v3.1.0

func (c *Ring) ExpireAt(key string, tm time.Time) *BoolCmd

func (*Ring) FlushAll added in v3.1.0

func (c *Ring) FlushAll() *StatusCmd

func (*Ring) FlushDb added in v3.1.0

func (c *Ring) FlushDb() *StatusCmd

func (*Ring) GeoAdd added in v3.2.11

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

func (*Ring) GeoDist added in v3.2.13

func (c *Ring) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*Ring) GeoHash added in v3.2.13

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

func (*Ring) GeoRadius added in v3.2.11

func (c *Ring) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*Ring) GeoRadiusByMember added in v3.2.13

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

func (*Ring) Get added in v3.1.0

func (c *Ring) Get(key string) *StringCmd

func (*Ring) GetBit added in v3.1.0

func (c *Ring) GetBit(key string, offset int64) *IntCmd

func (*Ring) GetRange added in v3.1.0

func (c *Ring) GetRange(key string, start, end int64) *StringCmd

func (*Ring) GetSet added in v3.1.0

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

func (*Ring) HDel added in v3.1.0

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

func (*Ring) HExists added in v3.1.0

func (c *Ring) HExists(key, field string) *BoolCmd

func (*Ring) HGet added in v3.1.0

func (c *Ring) HGet(key, field string) *StringCmd

func (*Ring) HGetAll added in v3.1.0

func (c *Ring) HGetAll(key string) *StringSliceCmd

func (*Ring) HGetAllMap added in v3.1.0

func (c *Ring) HGetAllMap(key string) *StringStringMapCmd

func (*Ring) HIncrBy added in v3.1.0

func (c *Ring) HIncrBy(key, field string, incr int64) *IntCmd

func (*Ring) HIncrByFloat added in v3.1.0

func (c *Ring) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*Ring) HKeys added in v3.1.0

func (c *Ring) HKeys(key string) *StringSliceCmd

func (*Ring) HLen added in v3.1.0

func (c *Ring) HLen(key string) *IntCmd

func (*Ring) HMGet added in v3.1.0

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

func (*Ring) HMSet added in v3.1.0

func (c *Ring) HMSet(key, field, value string, pairs ...string) *StatusCmd

func (*Ring) HMSetMap added in v3.6.2

func (c *Ring) HMSetMap(key string, fields map[string]string) *StatusCmd

func (*Ring) HScan added in v3.1.0

func (c *Ring) HScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Ring) HSet added in v3.1.0

func (c *Ring) HSet(key, field, value string) *BoolCmd

func (*Ring) HSetNX added in v3.1.0

func (c *Ring) HSetNX(key, field, value string) *BoolCmd

func (*Ring) HVals added in v3.1.0

func (c *Ring) HVals(key string) *StringSliceCmd

func (*Ring) Incr added in v3.1.0

func (c *Ring) Incr(key string) *IntCmd

func (*Ring) IncrBy added in v3.1.0

func (c *Ring) IncrBy(key string, value int64) *IntCmd

func (*Ring) IncrByFloat added in v3.1.0

func (c *Ring) IncrByFloat(key string, value float64) *FloatCmd

func (*Ring) Info added in v3.1.0

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

func (*Ring) Keys added in v3.1.0

func (c *Ring) Keys(pattern string) *StringSliceCmd

func (*Ring) LIndex added in v3.1.0

func (c *Ring) LIndex(key string, index int64) *StringCmd

func (*Ring) LInsert added in v3.1.0

func (c *Ring) LInsert(key, op, pivot, value string) *IntCmd

func (*Ring) LLen added in v3.1.0

func (c *Ring) LLen(key string) *IntCmd

func (*Ring) LPop added in v3.1.0

func (c *Ring) LPop(key string) *StringCmd

func (*Ring) LPush added in v3.1.0

func (c *Ring) LPush(key string, values ...string) *IntCmd

func (*Ring) LPushX added in v3.1.0

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

func (*Ring) LRange added in v3.1.0

func (c *Ring) LRange(key string, start, stop int64) *StringSliceCmd

func (*Ring) LRem added in v3.1.0

func (c *Ring) LRem(key string, count int64, value interface{}) *IntCmd

func (*Ring) LSet added in v3.1.0

func (c *Ring) LSet(key string, index int64, value interface{}) *StatusCmd

func (*Ring) LTrim added in v3.1.0

func (c *Ring) LTrim(key string, start, stop int64) *StatusCmd

func (*Ring) LastSave added in v3.1.0

func (c *Ring) LastSave() *IntCmd

func (*Ring) MGet added in v3.1.0

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

func (*Ring) MSet added in v3.1.0

func (c *Ring) MSet(pairs ...string) *StatusCmd

func (*Ring) MSetNX added in v3.1.0

func (c *Ring) MSetNX(pairs ...string) *BoolCmd

func (*Ring) Migrate added in v3.1.0

func (c *Ring) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*Ring) Move added in v3.1.0

func (c *Ring) Move(key string, db int64) *BoolCmd

func (*Ring) ObjectEncoding added in v3.1.0

func (c *Ring) ObjectEncoding(keys ...string) *StringCmd

func (*Ring) ObjectIdleTime added in v3.1.0

func (c *Ring) ObjectIdleTime(keys ...string) *DurationCmd

func (*Ring) ObjectRefCount added in v3.1.0

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

func (*Ring) PExpire added in v3.1.0

func (c *Ring) PExpire(key string, expiration time.Duration) *BoolCmd

func (*Ring) PExpireAt added in v3.1.0

func (c *Ring) PExpireAt(key string, tm time.Time) *BoolCmd

func (*Ring) PFAdd added in v3.2.14

func (c *Ring) PFAdd(key string, fields ...string) *IntCmd

func (*Ring) PFCount added in v3.2.14

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

func (*Ring) PFMerge added in v3.2.14

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

func (*Ring) PTTL added in v3.1.0

func (c *Ring) PTTL(key string) *DurationCmd

func (*Ring) Persist added in v3.1.0

func (c *Ring) Persist(key string) *BoolCmd

func (*Ring) Ping added in v3.1.0

func (c *Ring) Ping() *StatusCmd

func (*Ring) Pipeline added in v3.1.1

func (ring *Ring) Pipeline() *RingPipeline

func (*Ring) Pipelined added in v3.1.1

func (ring *Ring) Pipelined(fn func(*RingPipeline) error) ([]Cmder, error)

func (*Ring) Process added in v3.1.0

func (c *Ring) Process(cmd Cmder)

func (*Ring) PubSubChannels added in v3.1.0

func (c *Ring) PubSubChannels(pattern string) *StringSliceCmd

func (*Ring) PubSubNumPat added in v3.1.0

func (c *Ring) PubSubNumPat() *IntCmd

func (*Ring) PubSubNumSub added in v3.1.0

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

func (*Ring) Quit added in v3.1.0

func (c *Ring) Quit() *StatusCmd

func (*Ring) RPop added in v3.1.0

func (c *Ring) RPop(key string) *StringCmd

func (*Ring) RPopLPush added in v3.1.0

func (c *Ring) RPopLPush(source, destination string) *StringCmd

func (*Ring) RPush added in v3.1.0

func (c *Ring) RPush(key string, values ...string) *IntCmd

func (*Ring) RPushX added in v3.1.0

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

func (*Ring) RandomKey added in v3.1.0

func (c *Ring) RandomKey() *StringCmd

func (*Ring) ReadWrite added in v3.2.26

func (c *Ring) ReadWrite() *StatusCmd

func (*Ring) Readonly added in v3.2.26

func (c *Ring) Readonly() *StatusCmd

func (*Ring) Rename added in v3.1.0

func (c *Ring) Rename(key, newkey string) *StatusCmd

func (*Ring) RenameNX added in v3.1.0

func (c *Ring) RenameNX(key, newkey string) *BoolCmd

func (*Ring) Restore added in v3.1.0

func (c *Ring) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*Ring) RestoreReplace added in v3.2.0

func (c *Ring) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*Ring) SAdd added in v3.1.0

func (c *Ring) SAdd(key string, members ...string) *IntCmd

func (*Ring) SCard added in v3.1.0

func (c *Ring) SCard(key string) *IntCmd

func (*Ring) SDiff added in v3.1.0

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

func (*Ring) SDiffStore added in v3.1.0

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

func (*Ring) SInter added in v3.1.0

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

func (*Ring) SInterStore added in v3.1.0

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

func (*Ring) SIsMember added in v3.1.0

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

func (*Ring) SMembers added in v3.1.0

func (c *Ring) SMembers(key string) *StringSliceCmd

func (*Ring) SMove added in v3.1.0

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

func (*Ring) SPop added in v3.1.0

func (c *Ring) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*Ring) SPopN added in v3.6.3

func (c *Ring) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*Ring) SRandMember added in v3.1.0

func (c *Ring) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*Ring) SRandMemberN added in v3.2.6

func (c *Ring) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*Ring) SRem added in v3.1.0

func (c *Ring) SRem(key string, members ...string) *IntCmd

func (*Ring) SScan added in v3.1.0

func (c *Ring) SScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Ring) SUnion added in v3.1.0

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

func (*Ring) SUnionStore added in v3.1.0

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

func (*Ring) Save added in v3.1.0

func (c *Ring) Save() *StatusCmd

func (*Ring) Scan added in v3.1.0

func (c *Ring) Scan(cursor int64, match string, count int64) *ScanCmd

func (*Ring) ScriptExists added in v3.1.0

func (c *Ring) ScriptExists(scripts ...string) *BoolSliceCmd

func (*Ring) ScriptFlush added in v3.1.0

func (c *Ring) ScriptFlush() *StatusCmd

func (*Ring) ScriptKill added in v3.1.0

func (c *Ring) ScriptKill() *StatusCmd

func (*Ring) ScriptLoad added in v3.1.0

func (c *Ring) ScriptLoad(script string) *StringCmd

func (*Ring) Select added in v3.1.0

func (c *Ring) Select(index int64) *StatusCmd

func (*Ring) Set added in v3.1.0

func (c *Ring) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Zero expiration means the key has no expiration time.

func (*Ring) SetBit added in v3.1.0

func (c *Ring) SetBit(key string, offset int64, value int) *IntCmd

func (*Ring) SetNX added in v3.1.0

func (c *Ring) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Ring) SetRange added in v3.1.0

func (c *Ring) SetRange(key string, offset int64, value string) *IntCmd

func (*Ring) SetXX added in v3.4.0

func (c *Ring) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*Ring) Shutdown added in v3.1.0

func (c *Ring) Shutdown() *StatusCmd

func (*Ring) ShutdownNoSave added in v3.1.0

func (c *Ring) ShutdownNoSave() *StatusCmd

func (*Ring) ShutdownSave added in v3.1.0

func (c *Ring) ShutdownSave() *StatusCmd

func (*Ring) SlaveOf added in v3.1.0

func (c *Ring) SlaveOf(host, port string) *StatusCmd

func (*Ring) SlowLog added in v3.1.0

func (c *Ring) SlowLog()

func (*Ring) Sort added in v3.1.0

func (c *Ring) Sort(key string, sort Sort) *StringSliceCmd

func (*Ring) SortInterfaces added in v3.2.28

func (c *Ring) SortInterfaces(key string, sort Sort) *SliceCmd

func (*Ring) StrLen added in v3.1.0

func (c *Ring) StrLen(key string) *IntCmd

func (*Ring) Sync added in v3.1.0

func (c *Ring) Sync()

func (*Ring) TTL added in v3.1.0

func (c *Ring) TTL(key string) *DurationCmd

func (*Ring) Time added in v3.1.0

func (c *Ring) Time() *StringSliceCmd

func (*Ring) Type added in v3.1.0

func (c *Ring) Type(key string) *StatusCmd

func (*Ring) ZAdd added in v3.1.0

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

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

func (*Ring) ZAddCh added in v3.2.7

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

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

func (*Ring) ZAddNX added in v3.2.7

func (c *Ring) ZAddNX(key string, members ...Z) *IntCmd

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

func (*Ring) ZAddNXCh added in v3.2.7

func (c *Ring) ZAddNXCh(key string, members ...Z) *IntCmd

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

func (*Ring) ZAddXX added in v3.2.7

func (c *Ring) ZAddXX(key string, members ...Z) *IntCmd

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

func (*Ring) ZAddXXCh added in v3.2.7

func (c *Ring) ZAddXXCh(key string, members ...Z) *IntCmd

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

func (*Ring) ZCard added in v3.1.0

func (c *Ring) ZCard(key string) *IntCmd

func (*Ring) ZCount added in v3.1.0

func (c *Ring) ZCount(key, min, max string) *IntCmd

func (*Ring) ZIncr added in v3.2.7

func (c *Ring) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*Ring) ZIncrBy added in v3.1.0

func (c *Ring) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*Ring) ZIncrNX added in v3.2.7

func (c *Ring) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*Ring) ZIncrXX added in v3.2.7

func (c *Ring) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*Ring) ZInterStore added in v3.1.0

func (c *Ring) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*Ring) ZRange added in v3.1.0

func (c *Ring) ZRange(key string, start, stop int64) *StringSliceCmd

func (*Ring) ZRangeByLex added in v3.2.6

func (c *Ring) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Ring) ZRangeByScore added in v3.1.0

func (c *Ring) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Ring) ZRangeByScoreWithScores added in v3.1.0

func (c *Ring) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Ring) ZRangeWithScores added in v3.1.0

func (c *Ring) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Ring) ZRank added in v3.1.0

func (c *Ring) ZRank(key, member string) *IntCmd

func (*Ring) ZRem added in v3.1.0

func (c *Ring) ZRem(key string, members ...string) *IntCmd

func (*Ring) ZRemRangeByRank added in v3.1.0

func (c *Ring) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*Ring) ZRemRangeByScore added in v3.1.0

func (c *Ring) ZRemRangeByScore(key, min, max string) *IntCmd

func (*Ring) ZRevRange added in v3.1.0

func (c *Ring) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*Ring) ZRevRangeByLex added in v3.2.6

func (c *Ring) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*Ring) ZRevRangeByScore added in v3.1.0

func (c *Ring) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*Ring) ZRevRangeByScoreWithScores added in v3.1.0

func (c *Ring) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*Ring) ZRevRangeWithScores added in v3.1.0

func (c *Ring) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*Ring) ZRevRank added in v3.1.0

func (c *Ring) ZRevRank(key, member string) *IntCmd

func (*Ring) ZScan added in v3.1.0

func (c *Ring) ZScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*Ring) ZScore added in v3.1.0

func (c *Ring) ZScore(key, member string) *FloatCmd

func (*Ring) ZUnionStore added in v3.1.0

func (c *Ring) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type RingOptions added in v3.1.0

type RingOptions struct {
	// A map of name => host:port addresses of ring shards.
	Addrs map[string]string

	DB       int64
	Password string

	MaxRetries int

	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration

	PoolSize           int
	PoolTimeout        time.Duration
	IdleTimeout        time.Duration
	IdleCheckFrequency time.Duration
}

RingOptions are used to configure a ring client and should be passed to NewRing.

type RingPipeline added in v3.1.1

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

RingPipeline creates a new pipeline which is able to execute commands against multiple shards. It's NOT safe for concurrent use by multiple goroutines.

func (*RingPipeline) Append added in v3.1.1

func (c *RingPipeline) Append(key, value string) *IntCmd

func (*RingPipeline) Auth added in v3.1.1

func (c *RingPipeline) Auth(password string) *StatusCmd

func (*RingPipeline) BLPop added in v3.1.1

func (c *RingPipeline) BLPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*RingPipeline) BRPop added in v3.1.1

func (c *RingPipeline) BRPop(timeout time.Duration, keys ...string) *StringSliceCmd

func (*RingPipeline) BRPopLPush added in v3.1.1

func (c *RingPipeline) BRPopLPush(source, destination string, timeout time.Duration) *StringCmd

func (*RingPipeline) BgRewriteAOF added in v3.1.1

func (c *RingPipeline) BgRewriteAOF() *StatusCmd

func (*RingPipeline) BgSave added in v3.1.1

func (c *RingPipeline) BgSave() *StatusCmd

func (*RingPipeline) BitCount added in v3.1.1

func (c *RingPipeline) BitCount(key string, bitCount *BitCount) *IntCmd

func (*RingPipeline) BitOpAnd added in v3.1.1

func (c *RingPipeline) BitOpAnd(destKey string, keys ...string) *IntCmd

func (*RingPipeline) BitOpNot added in v3.1.1

func (c *RingPipeline) BitOpNot(destKey string, key string) *IntCmd

func (*RingPipeline) BitOpOr added in v3.1.1

func (c *RingPipeline) BitOpOr(destKey string, keys ...string) *IntCmd

func (*RingPipeline) BitOpXor added in v3.1.1

func (c *RingPipeline) BitOpXor(destKey string, keys ...string) *IntCmd

func (*RingPipeline) BitPos added in v3.1.1

func (c *RingPipeline) BitPos(key string, bit int64, pos ...int64) *IntCmd

func (*RingPipeline) ClientKill added in v3.1.1

func (c *RingPipeline) ClientKill(ipPort string) *StatusCmd

func (*RingPipeline) ClientList added in v3.1.1

func (c *RingPipeline) ClientList() *StringCmd

func (*RingPipeline) ClientPause added in v3.1.1

func (c *RingPipeline) ClientPause(dur time.Duration) *BoolCmd

func (*RingPipeline) ClientSetName added in v3.2.13

func (c *RingPipeline) ClientSetName(name string) *BoolCmd

ClientSetName assigns a name to the one of many connections in the pool.

func (*RingPipeline) Close added in v3.1.1

func (pipe *RingPipeline) Close() error

Close closes the pipeline, releasing any open resources.

func (*RingPipeline) ClusterAddSlots added in v3.1.1

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

func (*RingPipeline) ClusterAddSlotsRange added in v3.1.1

func (c *RingPipeline) ClusterAddSlotsRange(min, max int) *StatusCmd

func (*RingPipeline) ClusterCountFailureReports added in v3.2.26

func (c *RingPipeline) ClusterCountFailureReports(nodeID string) *IntCmd

func (*RingPipeline) ClusterCountKeysInSlot added in v3.2.26

func (c *RingPipeline) ClusterCountKeysInSlot(slot int) *IntCmd

func (*RingPipeline) ClusterDelSlots added in v3.2.26

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

func (*RingPipeline) ClusterDelSlotsRange added in v3.2.26

func (c *RingPipeline) ClusterDelSlotsRange(min, max int) *StatusCmd

func (*RingPipeline) ClusterFailover added in v3.1.1

func (c *RingPipeline) ClusterFailover() *StatusCmd

func (*RingPipeline) ClusterForget added in v3.2.20

func (c *RingPipeline) ClusterForget(nodeID string) *StatusCmd

func (*RingPipeline) ClusterInfo added in v3.1.1

func (c *RingPipeline) ClusterInfo() *StringCmd

func (*RingPipeline) ClusterKeySlot added in v3.2.26

func (c *RingPipeline) ClusterKeySlot(key string) *IntCmd

func (*RingPipeline) ClusterMeet added in v3.1.1

func (c *RingPipeline) ClusterMeet(host, port string) *StatusCmd

func (*RingPipeline) ClusterNodes added in v3.1.1

func (c *RingPipeline) ClusterNodes() *StringCmd

func (*RingPipeline) ClusterReplicate added in v3.1.1

func (c *RingPipeline) ClusterReplicate(nodeID string) *StatusCmd

func (*RingPipeline) ClusterResetHard added in v3.2.24

func (c *RingPipeline) ClusterResetHard() *StatusCmd

func (*RingPipeline) ClusterResetSoft added in v3.2.24

func (c *RingPipeline) ClusterResetSoft() *StatusCmd

func (*RingPipeline) ClusterSaveConfig added in v3.2.26

func (c *RingPipeline) ClusterSaveConfig() *StatusCmd

func (*RingPipeline) ClusterSlaves added in v3.2.26

func (c *RingPipeline) ClusterSlaves(nodeID string) *StringSliceCmd

func (*RingPipeline) ClusterSlots added in v3.1.1

func (c *RingPipeline) ClusterSlots() *ClusterSlotCmd

func (*RingPipeline) ConfigGet added in v3.1.1

func (c *RingPipeline) ConfigGet(parameter string) *SliceCmd

func (*RingPipeline) ConfigResetStat added in v3.1.1

func (c *RingPipeline) ConfigResetStat() *StatusCmd

func (*RingPipeline) ConfigSet added in v3.1.1

func (c *RingPipeline) ConfigSet(parameter, value string) *StatusCmd

func (*RingPipeline) DbSize added in v3.1.1

func (c *RingPipeline) DbSize() *IntCmd

func (*RingPipeline) DebugObject added in v3.1.1

func (c *RingPipeline) DebugObject(key string) *StringCmd

func (*RingPipeline) Decr added in v3.1.1

func (c *RingPipeline) Decr(key string) *IntCmd

func (*RingPipeline) DecrBy added in v3.1.1

func (c *RingPipeline) DecrBy(key string, decrement int64) *IntCmd

func (*RingPipeline) Del added in v3.1.1

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

func (*RingPipeline) Discard added in v3.1.1

func (pipe *RingPipeline) Discard() error

Discard resets the pipeline and discards queued commands.

func (*RingPipeline) Dump added in v3.1.1

func (c *RingPipeline) Dump(key string) *StringCmd

func (*RingPipeline) Echo added in v3.1.1

func (c *RingPipeline) Echo(message string) *StringCmd

func (*RingPipeline) Eval added in v3.1.1

func (c *RingPipeline) Eval(script string, keys []string, args []string) *Cmd

func (*RingPipeline) EvalSha added in v3.1.1

func (c *RingPipeline) EvalSha(sha1 string, keys []string, args []string) *Cmd

func (*RingPipeline) Exec added in v3.1.1

func (pipe *RingPipeline) Exec() (cmds []Cmder, retErr error)

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

func (*RingPipeline) Exists added in v3.1.1

func (c *RingPipeline) Exists(key string) *BoolCmd

func (*RingPipeline) Expire added in v3.1.1

func (c *RingPipeline) Expire(key string, expiration time.Duration) *BoolCmd

func (*RingPipeline) ExpireAt added in v3.1.1

func (c *RingPipeline) ExpireAt(key string, tm time.Time) *BoolCmd

func (*RingPipeline) FlushAll added in v3.1.1

func (c *RingPipeline) FlushAll() *StatusCmd

func (*RingPipeline) FlushDb added in v3.1.1

func (c *RingPipeline) FlushDb() *StatusCmd

func (*RingPipeline) GeoAdd added in v3.2.11

func (c *RingPipeline) GeoAdd(key string, geoLocation ...*GeoLocation) *IntCmd

func (*RingPipeline) GeoDist added in v3.2.13

func (c *RingPipeline) GeoDist(key string, member1, member2, unit string) *FloatCmd

func (*RingPipeline) GeoHash added in v3.2.13

func (c *RingPipeline) GeoHash(key string, members ...string) *StringSliceCmd

func (*RingPipeline) GeoRadius added in v3.2.11

func (c *RingPipeline) GeoRadius(key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd

func (*RingPipeline) GeoRadiusByMember added in v3.2.13

func (c *RingPipeline) GeoRadiusByMember(key, member string, query *GeoRadiusQuery) *GeoLocationCmd

func (*RingPipeline) Get added in v3.1.1

func (c *RingPipeline) Get(key string) *StringCmd

func (*RingPipeline) GetBit added in v3.1.1

func (c *RingPipeline) GetBit(key string, offset int64) *IntCmd

func (*RingPipeline) GetRange added in v3.1.1

func (c *RingPipeline) GetRange(key string, start, end int64) *StringCmd

func (*RingPipeline) GetSet added in v3.1.1

func (c *RingPipeline) GetSet(key string, value interface{}) *StringCmd

func (*RingPipeline) HDel added in v3.1.1

func (c *RingPipeline) HDel(key string, fields ...string) *IntCmd

func (*RingPipeline) HExists added in v3.1.1

func (c *RingPipeline) HExists(key, field string) *BoolCmd

func (*RingPipeline) HGet added in v3.1.1

func (c *RingPipeline) HGet(key, field string) *StringCmd

func (*RingPipeline) HGetAll added in v3.1.1

func (c *RingPipeline) HGetAll(key string) *StringSliceCmd

func (*RingPipeline) HGetAllMap added in v3.1.1

func (c *RingPipeline) HGetAllMap(key string) *StringStringMapCmd

func (*RingPipeline) HIncrBy added in v3.1.1

func (c *RingPipeline) HIncrBy(key, field string, incr int64) *IntCmd

func (*RingPipeline) HIncrByFloat added in v3.1.1

func (c *RingPipeline) HIncrByFloat(key, field string, incr float64) *FloatCmd

func (*RingPipeline) HKeys added in v3.1.1

func (c *RingPipeline) HKeys(key string) *StringSliceCmd

func (*RingPipeline) HLen added in v3.1.1

func (c *RingPipeline) HLen(key string) *IntCmd

func (*RingPipeline) HMGet added in v3.1.1

func (c *RingPipeline) HMGet(key string, fields ...string) *SliceCmd

func (*RingPipeline) HMSet added in v3.1.1

func (c *RingPipeline) HMSet(key, field, value string, pairs ...string) *StatusCmd

func (*RingPipeline) HMSetMap added in v3.6.2

func (c *RingPipeline) HMSetMap(key string, fields map[string]string) *StatusCmd

func (*RingPipeline) HScan added in v3.1.1

func (c *RingPipeline) HScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*RingPipeline) HSet added in v3.1.1

func (c *RingPipeline) HSet(key, field, value string) *BoolCmd

func (*RingPipeline) HSetNX added in v3.1.1

func (c *RingPipeline) HSetNX(key, field, value string) *BoolCmd

func (*RingPipeline) HVals added in v3.1.1

func (c *RingPipeline) HVals(key string) *StringSliceCmd

func (*RingPipeline) Incr added in v3.1.1

func (c *RingPipeline) Incr(key string) *IntCmd

func (*RingPipeline) IncrBy added in v3.1.1

func (c *RingPipeline) IncrBy(key string, value int64) *IntCmd

func (*RingPipeline) IncrByFloat added in v3.1.1

func (c *RingPipeline) IncrByFloat(key string, value float64) *FloatCmd

func (*RingPipeline) Info added in v3.1.1

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

func (*RingPipeline) Keys added in v3.1.1

func (c *RingPipeline) Keys(pattern string) *StringSliceCmd

func (*RingPipeline) LIndex added in v3.1.1

func (c *RingPipeline) LIndex(key string, index int64) *StringCmd

func (*RingPipeline) LInsert added in v3.1.1

func (c *RingPipeline) LInsert(key, op, pivot, value string) *IntCmd

func (*RingPipeline) LLen added in v3.1.1

func (c *RingPipeline) LLen(key string) *IntCmd

func (*RingPipeline) LPop added in v3.1.1

func (c *RingPipeline) LPop(key string) *StringCmd

func (*RingPipeline) LPush added in v3.1.1

func (c *RingPipeline) LPush(key string, values ...string) *IntCmd

func (*RingPipeline) LPushX added in v3.1.1

func (c *RingPipeline) LPushX(key, value interface{}) *IntCmd

func (*RingPipeline) LRange added in v3.1.1

func (c *RingPipeline) LRange(key string, start, stop int64) *StringSliceCmd

func (*RingPipeline) LRem added in v3.1.1

func (c *RingPipeline) LRem(key string, count int64, value interface{}) *IntCmd

func (*RingPipeline) LSet added in v3.1.1

func (c *RingPipeline) LSet(key string, index int64, value interface{}) *StatusCmd

func (*RingPipeline) LTrim added in v3.1.1

func (c *RingPipeline) LTrim(key string, start, stop int64) *StatusCmd

func (*RingPipeline) LastSave added in v3.1.1

func (c *RingPipeline) LastSave() *IntCmd

func (*RingPipeline) MGet added in v3.1.1

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

func (*RingPipeline) MSet added in v3.1.1

func (c *RingPipeline) MSet(pairs ...string) *StatusCmd

func (*RingPipeline) MSetNX added in v3.1.1

func (c *RingPipeline) MSetNX(pairs ...string) *BoolCmd

func (*RingPipeline) Migrate added in v3.1.1

func (c *RingPipeline) Migrate(host, port, key string, db int64, timeout time.Duration) *StatusCmd

func (*RingPipeline) Move added in v3.1.1

func (c *RingPipeline) Move(key string, db int64) *BoolCmd

func (*RingPipeline) ObjectEncoding added in v3.1.1

func (c *RingPipeline) ObjectEncoding(keys ...string) *StringCmd

func (*RingPipeline) ObjectIdleTime added in v3.1.1

func (c *RingPipeline) ObjectIdleTime(keys ...string) *DurationCmd

func (*RingPipeline) ObjectRefCount added in v3.1.1

func (c *RingPipeline) ObjectRefCount(keys ...string) *IntCmd

func (*RingPipeline) PExpire added in v3.1.1

func (c *RingPipeline) PExpire(key string, expiration time.Duration) *BoolCmd

func (*RingPipeline) PExpireAt added in v3.1.1

func (c *RingPipeline) PExpireAt(key string, tm time.Time) *BoolCmd

func (*RingPipeline) PFAdd added in v3.2.14

func (c *RingPipeline) PFAdd(key string, fields ...string) *IntCmd

func (*RingPipeline) PFCount added in v3.2.14

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

func (*RingPipeline) PFMerge added in v3.2.14

func (c *RingPipeline) PFMerge(dest string, keys ...string) *StatusCmd

func (*RingPipeline) PTTL added in v3.1.1

func (c *RingPipeline) PTTL(key string) *DurationCmd

func (*RingPipeline) Persist added in v3.1.1

func (c *RingPipeline) Persist(key string) *BoolCmd

func (*RingPipeline) Ping added in v3.1.1

func (c *RingPipeline) Ping() *StatusCmd

func (*RingPipeline) Process added in v3.1.1

func (c *RingPipeline) Process(cmd Cmder)

func (*RingPipeline) PubSubChannels added in v3.1.1

func (c *RingPipeline) PubSubChannels(pattern string) *StringSliceCmd

func (*RingPipeline) PubSubNumPat added in v3.1.1

func (c *RingPipeline) PubSubNumPat() *IntCmd

func (*RingPipeline) PubSubNumSub added in v3.1.1

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

func (*RingPipeline) Quit added in v3.1.1

func (c *RingPipeline) Quit() *StatusCmd

func (*RingPipeline) RPop added in v3.1.1

func (c *RingPipeline) RPop(key string) *StringCmd

func (*RingPipeline) RPopLPush added in v3.1.1

func (c *RingPipeline) RPopLPush(source, destination string) *StringCmd

func (*RingPipeline) RPush added in v3.1.1

func (c *RingPipeline) RPush(key string, values ...string) *IntCmd

func (*RingPipeline) RPushX added in v3.1.1

func (c *RingPipeline) RPushX(key string, value interface{}) *IntCmd

func (*RingPipeline) RandomKey added in v3.1.1

func (c *RingPipeline) RandomKey() *StringCmd

func (*RingPipeline) ReadWrite added in v3.2.26

func (c *RingPipeline) ReadWrite() *StatusCmd

func (*RingPipeline) Readonly added in v3.2.26

func (c *RingPipeline) Readonly() *StatusCmd

func (*RingPipeline) Rename added in v3.1.1

func (c *RingPipeline) Rename(key, newkey string) *StatusCmd

func (*RingPipeline) RenameNX added in v3.1.1

func (c *RingPipeline) RenameNX(key, newkey string) *BoolCmd

func (*RingPipeline) Restore added in v3.1.1

func (c *RingPipeline) Restore(key string, ttl time.Duration, value string) *StatusCmd

func (*RingPipeline) RestoreReplace added in v3.2.0

func (c *RingPipeline) RestoreReplace(key string, ttl time.Duration, value string) *StatusCmd

func (*RingPipeline) SAdd added in v3.1.1

func (c *RingPipeline) SAdd(key string, members ...string) *IntCmd

func (*RingPipeline) SCard added in v3.1.1

func (c *RingPipeline) SCard(key string) *IntCmd

func (*RingPipeline) SDiff added in v3.1.1

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

func (*RingPipeline) SDiffStore added in v3.1.1

func (c *RingPipeline) SDiffStore(destination string, keys ...string) *IntCmd

func (*RingPipeline) SInter added in v3.1.1

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

func (*RingPipeline) SInterStore added in v3.1.1

func (c *RingPipeline) SInterStore(destination string, keys ...string) *IntCmd

func (*RingPipeline) SIsMember added in v3.1.1

func (c *RingPipeline) SIsMember(key string, member interface{}) *BoolCmd

func (*RingPipeline) SMembers added in v3.1.1

func (c *RingPipeline) SMembers(key string) *StringSliceCmd

func (*RingPipeline) SMove added in v3.1.1

func (c *RingPipeline) SMove(source, destination string, member interface{}) *BoolCmd

func (*RingPipeline) SPop added in v3.1.1

func (c *RingPipeline) SPop(key string) *StringCmd

Redis `SPOP key` command.

func (*RingPipeline) SPopN added in v3.6.3

func (c *RingPipeline) SPopN(key string, count int64) *StringSliceCmd

Redis `SPOP key count` command.

func (*RingPipeline) SRandMember added in v3.1.1

func (c *RingPipeline) SRandMember(key string) *StringCmd

Redis `SRANDMEMBER key` command.

func (*RingPipeline) SRandMemberN added in v3.2.6

func (c *RingPipeline) SRandMemberN(key string, count int64) *StringSliceCmd

Redis `SRANDMEMBER key count` command.

func (*RingPipeline) SRem added in v3.1.1

func (c *RingPipeline) SRem(key string, members ...string) *IntCmd

func (*RingPipeline) SScan added in v3.1.1

func (c *RingPipeline) SScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*RingPipeline) SUnion added in v3.1.1

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

func (*RingPipeline) SUnionStore added in v3.1.1

func (c *RingPipeline) SUnionStore(destination string, keys ...string) *IntCmd

func (*RingPipeline) Save added in v3.1.1

func (c *RingPipeline) Save() *StatusCmd

func (*RingPipeline) Scan added in v3.1.1

func (c *RingPipeline) Scan(cursor int64, match string, count int64) *ScanCmd

func (*RingPipeline) ScriptExists added in v3.1.1

func (c *RingPipeline) ScriptExists(scripts ...string) *BoolSliceCmd

func (*RingPipeline) ScriptFlush added in v3.1.1

func (c *RingPipeline) ScriptFlush() *StatusCmd

func (*RingPipeline) ScriptKill added in v3.1.1

func (c *RingPipeline) ScriptKill() *StatusCmd

func (*RingPipeline) ScriptLoad added in v3.1.1

func (c *RingPipeline) ScriptLoad(script string) *StringCmd

func (*RingPipeline) Select added in v3.1.1

func (c *RingPipeline) Select(index int64) *StatusCmd

func (*RingPipeline) Set added in v3.1.1

func (c *RingPipeline) Set(key string, value interface{}, expiration time.Duration) *StatusCmd

Redis `SET key value [expiration]` command.

Zero expiration means the key has no expiration time.

func (*RingPipeline) SetBit added in v3.1.1

func (c *RingPipeline) SetBit(key string, offset int64, value int) *IntCmd

func (*RingPipeline) SetNX added in v3.1.1

func (c *RingPipeline) SetNX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*RingPipeline) SetRange added in v3.1.1

func (c *RingPipeline) SetRange(key string, offset int64, value string) *IntCmd

func (*RingPipeline) SetXX added in v3.4.0

func (c *RingPipeline) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd

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

Zero expiration means the key has no expiration time.

func (*RingPipeline) Shutdown added in v3.1.1

func (c *RingPipeline) Shutdown() *StatusCmd

func (*RingPipeline) ShutdownNoSave added in v3.1.1

func (c *RingPipeline) ShutdownNoSave() *StatusCmd

func (*RingPipeline) ShutdownSave added in v3.1.1

func (c *RingPipeline) ShutdownSave() *StatusCmd

func (*RingPipeline) SlaveOf added in v3.1.1

func (c *RingPipeline) SlaveOf(host, port string) *StatusCmd

func (*RingPipeline) SlowLog added in v3.1.1

func (c *RingPipeline) SlowLog()

func (*RingPipeline) Sort added in v3.1.1

func (c *RingPipeline) Sort(key string, sort Sort) *StringSliceCmd

func (*RingPipeline) SortInterfaces added in v3.2.28

func (c *RingPipeline) SortInterfaces(key string, sort Sort) *SliceCmd

func (*RingPipeline) StrLen added in v3.1.1

func (c *RingPipeline) StrLen(key string) *IntCmd

func (*RingPipeline) Sync added in v3.1.1

func (c *RingPipeline) Sync()

func (*RingPipeline) TTL added in v3.1.1

func (c *RingPipeline) TTL(key string) *DurationCmd

func (*RingPipeline) Time added in v3.1.1

func (c *RingPipeline) Time() *StringSliceCmd

func (*RingPipeline) Type added in v3.1.1

func (c *RingPipeline) Type(key string) *StatusCmd

func (*RingPipeline) ZAdd added in v3.1.1

func (c *RingPipeline) ZAdd(key string, members ...Z) *IntCmd

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

func (*RingPipeline) ZAddCh added in v3.2.7

func (c *RingPipeline) ZAddCh(key string, members ...Z) *IntCmd

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

func (*RingPipeline) ZAddNX added in v3.2.7

func (c *RingPipeline) ZAddNX(key string, members ...Z) *IntCmd

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

func (*RingPipeline) ZAddNXCh added in v3.2.7

func (c *RingPipeline) ZAddNXCh(key string, members ...Z) *IntCmd

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

func (*RingPipeline) ZAddXX added in v3.2.7

func (c *RingPipeline) ZAddXX(key string, members ...Z) *IntCmd

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

func (*RingPipeline) ZAddXXCh added in v3.2.7

func (c *RingPipeline) ZAddXXCh(key string, members ...Z) *IntCmd

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

func (*RingPipeline) ZCard added in v3.1.1

func (c *RingPipeline) ZCard(key string) *IntCmd

func (*RingPipeline) ZCount added in v3.1.1

func (c *RingPipeline) ZCount(key, min, max string) *IntCmd

func (*RingPipeline) ZIncr added in v3.2.7

func (c *RingPipeline) ZIncr(key string, member Z) *FloatCmd

Redis `ZADD key INCR score member` command.

func (*RingPipeline) ZIncrBy added in v3.1.1

func (c *RingPipeline) ZIncrBy(key string, increment float64, member string) *FloatCmd

func (*RingPipeline) ZIncrNX added in v3.2.7

func (c *RingPipeline) ZIncrNX(key string, member Z) *FloatCmd

Redis `ZADD key NX INCR score member` command.

func (*RingPipeline) ZIncrXX added in v3.2.7

func (c *RingPipeline) ZIncrXX(key string, member Z) *FloatCmd

Redis `ZADD key XX INCR score member` command.

func (*RingPipeline) ZInterStore added in v3.1.1

func (c *RingPipeline) ZInterStore(destination string, store ZStore, keys ...string) *IntCmd

func (*RingPipeline) ZRange added in v3.1.1

func (c *RingPipeline) ZRange(key string, start, stop int64) *StringSliceCmd

func (*RingPipeline) ZRangeByLex added in v3.2.6

func (c *RingPipeline) ZRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*RingPipeline) ZRangeByScore added in v3.1.1

func (c *RingPipeline) ZRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*RingPipeline) ZRangeByScoreWithScores added in v3.1.1

func (c *RingPipeline) ZRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*RingPipeline) ZRangeWithScores added in v3.1.1

func (c *RingPipeline) ZRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*RingPipeline) ZRank added in v3.1.1

func (c *RingPipeline) ZRank(key, member string) *IntCmd

func (*RingPipeline) ZRem added in v3.1.1

func (c *RingPipeline) ZRem(key string, members ...string) *IntCmd

func (*RingPipeline) ZRemRangeByRank added in v3.1.1

func (c *RingPipeline) ZRemRangeByRank(key string, start, stop int64) *IntCmd

func (*RingPipeline) ZRemRangeByScore added in v3.1.1

func (c *RingPipeline) ZRemRangeByScore(key, min, max string) *IntCmd

func (*RingPipeline) ZRevRange added in v3.1.1

func (c *RingPipeline) ZRevRange(key string, start, stop int64) *StringSliceCmd

func (*RingPipeline) ZRevRangeByLex added in v3.2.6

func (c *RingPipeline) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd

func (*RingPipeline) ZRevRangeByScore added in v3.1.1

func (c *RingPipeline) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSliceCmd

func (*RingPipeline) ZRevRangeByScoreWithScores added in v3.1.1

func (c *RingPipeline) ZRevRangeByScoreWithScores(key string, opt ZRangeByScore) *ZSliceCmd

func (*RingPipeline) ZRevRangeWithScores added in v3.1.1

func (c *RingPipeline) ZRevRangeWithScores(key string, start, stop int64) *ZSliceCmd

func (*RingPipeline) ZRevRank added in v3.1.1

func (c *RingPipeline) ZRevRank(key, member string) *IntCmd

func (*RingPipeline) ZScan added in v3.1.1

func (c *RingPipeline) ZScan(key string, cursor int64, match string, count int64) *ScanCmd

func (*RingPipeline) ZScore added in v3.1.1

func (c *RingPipeline) ZScore(key, member string) *FloatCmd

func (*RingPipeline) ZUnionStore added in v3.1.1

func (c *RingPipeline) ZUnionStore(dest string, store ZStore, keys ...string) *IntCmd

type ScanCmd

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

func NewScanCmd

func NewScanCmd(args ...interface{}) *ScanCmd

func (*ScanCmd) Err

func (cmd *ScanCmd) Err() error

func (*ScanCmd) Result

func (cmd *ScanCmd) Result() (int64, []string, error)

func (*ScanCmd) String

func (cmd *ScanCmd) String() string

func (*ScanCmd) Val

func (cmd *ScanCmd) Val() (int64, []string)

type Script

type Script struct {
	// contains filtered or unexported fields
}
Example
IncrByXX := redis.NewScript(`
		if redis.call("GET", KEYS[1]) ~= false then
			return redis.call("INCRBY", KEYS[1], ARGV[1])
		end
		return false
	`)

n, err := IncrByXX.Run(client, []string{"xx_counter"}, []string{"2"}).Result()
fmt.Println(n, err)

err = client.Set("xx_counter", "40", 0).Err()
if err != nil {
	panic(err)
}

n, err = IncrByXX.Run(client, []string{"xx_counter"}, []string{"2"}).Result()
fmt.Println(n, err)
Output:

<nil> redis: nil
42 <nil>

func NewScript

func NewScript(src string) *Script

func (*Script) Eval

func (s *Script) Eval(c scripter, keys []string, args []string) *Cmd

func (*Script) EvalSha

func (s *Script) EvalSha(c scripter, keys []string, args []string) *Cmd

func (*Script) Exists

func (s *Script) Exists(c scripter) *BoolSliceCmd

func (*Script) Load

func (s *Script) Load(c scripter) *StringCmd

func (*Script) Run

func (s *Script) Run(c scripter, keys []string, args []string) *Cmd

type SliceCmd

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

func NewSliceCmd

func NewSliceCmd(args ...interface{}) *SliceCmd

func (*SliceCmd) Err

func (cmd *SliceCmd) Err() error

func (*SliceCmd) Result

func (cmd *SliceCmd) Result() ([]interface{}, error)

func (*SliceCmd) String

func (cmd *SliceCmd) String() string

func (*SliceCmd) Val

func (cmd *SliceCmd) Val() []interface{}

type Sort

type Sort struct {
	By            string
	Offset, Count float64
	Get           []string
	Order         string
	IsAlpha       bool
	Store         string
}

type StatusCmd

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

func NewStatusCmd

func NewStatusCmd(args ...interface{}) *StatusCmd

func (*StatusCmd) Err

func (cmd *StatusCmd) Err() error

func (*StatusCmd) Result

func (cmd *StatusCmd) Result() (string, error)

func (*StatusCmd) String

func (cmd *StatusCmd) String() string

func (*StatusCmd) Val

func (cmd *StatusCmd) Val() string

type StringCmd

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

func NewStringCmd

func NewStringCmd(args ...interface{}) *StringCmd

func (*StringCmd) Bytes added in v3.2.0

func (cmd *StringCmd) Bytes() ([]byte, error)

func (*StringCmd) Err

func (cmd *StringCmd) Err() error

func (*StringCmd) Float64

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

func (*StringCmd) Int64

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

func (*StringCmd) Result

func (cmd *StringCmd) Result() (string, error)

func (*StringCmd) Scan added in v3.2.0

func (cmd *StringCmd) Scan(val interface{}) error

func (*StringCmd) String

func (cmd *StringCmd) String() string

func (*StringCmd) Uint64

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

func (*StringCmd) Val

func (cmd *StringCmd) Val() string

type StringIntMapCmd

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

func NewStringIntMapCmd

func NewStringIntMapCmd(args ...interface{}) *StringIntMapCmd

func (*StringIntMapCmd) Err

func (cmd *StringIntMapCmd) Err() error

func (*StringIntMapCmd) Result

func (cmd *StringIntMapCmd) Result() (map[string]int64, error)

func (*StringIntMapCmd) String

func (cmd *StringIntMapCmd) String() string

func (*StringIntMapCmd) Val

func (cmd *StringIntMapCmd) Val() map[string]int64

type StringSliceCmd

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

func NewStringSliceCmd

func NewStringSliceCmd(args ...interface{}) *StringSliceCmd

func (*StringSliceCmd) Err

func (cmd *StringSliceCmd) Err() error

func (*StringSliceCmd) Result

func (cmd *StringSliceCmd) Result() ([]string, error)

func (*StringSliceCmd) String

func (cmd *StringSliceCmd) String() string

func (*StringSliceCmd) Val

func (cmd *StringSliceCmd) Val() []string

type StringStringMapCmd

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

func NewStringStringMapCmd

func NewStringStringMapCmd(args ...interface{}) *StringStringMapCmd

func (*StringStringMapCmd) Err

func (cmd *StringStringMapCmd) Err() error

func (*StringStringMapCmd) Result

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

func (*StringStringMapCmd) String

func (cmd *StringStringMapCmd) String() string

func (*StringStringMapCmd) Val

func (cmd *StringStringMapCmd) Val() map[string]string

type Subscription

type Subscription struct {
	// Can be "subscribe", "unsubscribe", "psubscribe" or "punsubscribe".
	Kind string
	// Channel name we have subscribed to.
	Channel string
	// Number of channels we are currently subscribed to.
	Count int
}

Message received after a successful subscription to channel.

func (*Subscription) String

func (m *Subscription) String() string

type Z

type Z struct {
	Score  float64
	Member interface{}
}

Z represents sorted set member.

type ZRangeByScore

type ZRangeByScore struct {
	Min, Max      string
	Offset, Count int64
}

TODO: Rename to something more generic in v4

type ZSliceCmd

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

func NewZSliceCmd

func NewZSliceCmd(args ...interface{}) *ZSliceCmd

func (*ZSliceCmd) Err

func (cmd *ZSliceCmd) Err() error

func (*ZSliceCmd) Result

func (cmd *ZSliceCmd) Result() ([]Z, error)

func (*ZSliceCmd) String

func (cmd *ZSliceCmd) String() string

func (*ZSliceCmd) Val

func (cmd *ZSliceCmd) Val() []Z

type ZStore

type ZStore struct {
	Weights []float64
	// Can be SUM, MIN or MAX.
	Aggregate string
}

ZStore is used as an arg to ZInterStore and ZUnionStore.

Directories

Path Synopsis
consistenthash
Package consistenthash provides an implementation of a ring hash.
Package consistenthash provides an implementation of a ring hash.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL