godis

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 14 Imported by: 4

README

godis

Go Doc Build Status Code Coverage License

redis client implement by golang, refer to jedis.

  • cluster
  • pipeline
  • transaction
  • distributed lock
  • other feature under development

Installation

go get -u github.com/piaohao/godis

or use go.mod:

require github.com/piaohao/godis latest

Documentation

Quick Start

  1. basic example

    package main
    
    import (
        "github.com/piaohao/godis"
    )
    
    func main() {
        redis := godis.NewRedis(godis.ShardInfo{
            Host: "localhost",
            Port: 6379,
            Db:   0,
        })
        redis.Connect()
        defer redis.Close()
        redis.Set("godis", "1")
        arr, _ := redis.Get("godis")
        println(string(arr))
    }
    
  2. use pool

    package main
    
    import (
        "github.com/piaohao/godis"
    )
    
    func main() {
        factory := godis.NewFactory(godis.ShardInfo{
            Host: "localhost",
            Port: 6379,
            Db:   0,
        })
        pool := godis.NewPool(godis.PoolConfig{}, factory)
        redis, _ := pool.GetResource()
        defer redis.Close()
        redis.Set("godis", "1")
        arr, _ := redis.Get("godis")
        println(string(arr))
    }
    
  3. pubsub

    package main
    
    import (
        "github.com/piaohao/godis"
        "time"
    )
    
    func main() {
        factory := godis.NewFactory(godis.ShardInfo{
            Host: "localhost",
            Port: 6379,
            Db:   0,
        })
        pool := godis.NewPool(godis.PoolConfig{}, factory)
        go func() {
            redis, _ := pool.GetResource()
            defer redis.Close()
            pubsub := &godis.RedisPubSub{
                Redis: redis,
                OnMessage: func(channel, message string) {
                    println(channel, message)
                },
                OnSubscribe: func(channel string, subscribedChannels int) {
                    println(channel, subscribedChannels)
                },
                OnPong: func(channel string) {
                    println("recieve pong")
                },
            }
            redis.Subscribe(pubsub, "godis")
        }()
        time.Sleep(1 * time.Second)
        {
            redis, _ := pool.GetResource()
            defer redis.Close()
            redis.Publish("godis", "godis pubsub")
            redis.Close()
        }
        time.Sleep(1 * time.Second)
    }
    
  4. cluster

    package main
    
    import (
        "github.com/piaohao/godis"
        "time"
    )
    
    func main() {
        cluster := godis.NewRedisCluster([]string{"192.168.1.6:8001", "192.168.1.6:8002", "192.168.1.6:8003", "192.168.1.6:8004", "192.168.1.6:8005", "192.168.1.6:8006"},
        	0, 0, 1, "", godis.PoolConfig{})
        cluster.Set("cluster", "godis cluster")
        reply, _ := cluster.Get("cluster")
        println(reply)
    }
    
  5. pipeline

    package main
    
    import (
        "github.com/piaohao/godis"
        "time"
    )
    
    func main() {
        factory := godis.NewFactory(godis.ShardInfo{
            Host: "localhost",
            Port: 6379,
            Db:   0,
        })
        pool := godis.NewPool(godis.PoolConfig{}, factory)
        redis, _ := pool.GetResource()
        defer redis.Close()
        p := redis.Pipelined()
        infoResp, _ := p.Info()
        timeResp, _ := p.Time()
        p.Sync()
        timeList, _ := timeResp.Get()
        println(timeList)
        info, _ := infoResp.Get()
        println(info)
    }
    
  6. transaction

    package main
    
    import (
        "github.com/piaohao/godis"
        "time"
    )
    
    func main() {
        factory := godis.NewFactory(godis.ShardInfo{
            Host: "localhost",
            Port: 6379,
            Db:   0,
        })
        pool := godis.NewPool(godis.PoolConfig{}, factory)
        redis, _ := pool.GetResource()
        defer redis.Close()
        p, _ := redis.Multi()
        infoResp, _ := p.Info()
        timeResp, _ := p.Time()
        p.Exec()
        timeList, _ := timeResp.Get()
        println(timeList)
        info, _ := infoResp.Get()
        println(info)
    }
    

License

godis is licensed under the MIT License, 100% free and open-source, forever.

Thanks

Contact

piao.hao@qq.com

Documentation

Overview

godis

Index

Constants

View Source
const (
	ASK_PREFIX         = "ASK "
	MOVED_PREFIX       = "MOVED "
	CLUSTERDOWN_PREFIX = "CLUSTERDOWN "
	BUSY_PREFIX        = "BUSY "
	NOSCRIPT_PREFIX    = "NOSCRIPT "

	DEFAULT_HOST          = "localhost"
	DEFAULT_PORT          = 6379
	DEFAULT_SENTINEL_PORT = 26379
	DEFAULT_TIMEOUT       = 2000
	DEFAULT_DATABASE      = 0

	CHARSET = "UTF-8"

	DOLLAR_BYTE   = '$'
	ASTERISK_BYTE = '*'
	PLUS_BYTE     = '+'
	MINUS_BYTE    = '-'
	COLON_BYTE    = ':'

	SENTINEL_MASTERS                 = "masters"
	SENTINEL_GET_MASTER_ADDR_BY_NAME = "get-master-addr-by-name"
	SENTINEL_RESET                   = "reset"
	SENTINEL_SLAVES                  = "slaves"
	SENTINEL_FAILOVER                = "failover"
	SENTINEL_MONITOR                 = "monitor"
	SENTINEL_REMOVE                  = "remove"
	SENTINEL_SET                     = "set"

	CLUSTER_NODES             = "nodes"
	CLUSTER_MEET              = "meet"
	CLUSTER_RESET             = "reset"
	CLUSTER_ADDSLOTS          = "addslots"
	CLUSTER_DELSLOTS          = "delslots"
	CLUSTER_INFO              = "info"
	CLUSTER_GETKEYSINSLOT     = "getkeysinslot"
	CLUSTER_SETSLOT           = "setslot"
	CLUSTER_SETSLOT_NODE      = "node"
	CLUSTER_SETSLOT_MIGRATING = "migrating"
	CLUSTER_SETSLOT_IMPORTING = "importing"
	CLUSTER_SETSLOT_STABLE    = "stable"
	CLUSTER_FORGET            = "forget"
	CLUSTER_FLUSHSLOT         = "flushslots"
	CLUSTER_KEYSLOT           = "keyslot"
	CLUSTER_COUNTKEYINSLOT    = "countkeysinslot"
	CLUSTER_SAVECONFIG        = "saveconfig"
	CLUSTER_REPLICATE         = "replicate"
	CLUSTER_SLAVES            = "slaves"
	CLUSTER_FAILOVER          = "failover"
	CLUSTER_SLOTS             = "slots"
	PUBSUB_CHANNELS           = "channels"
	PUBSUB_NUMSUB             = "numsub"
	PUBSUB_NUM_PAT            = "numpat"
)
View Source
const COMMA = ","
View Source
const (
	MASTER_NODE_INDEX = 2
)

Variables

View Source
var (
	STRING_BUILDER       = newStringBuilder()
	STRING_ARRAY_BUILDER = newStringArrayBuilder()
)
View Source
var (
	ListOption_BEFORE = newListOption("BEFORE")
	ListOption_AFTER  = newListOption("AFTER")
)
View Source
var (
	GEOUNIT_MI = newGeoUnit("MI")
	GEOUNIT_M  = newGeoUnit("M")
	GEOUNIT_KM = newGeoUnit("KM")
	GEOUNIT_FT = newGeoUnit("FT")
)
View Source
var (
	ZParams_SUM = newZParams("SUM")
	ZParams_MIN = newZParams("MIN")
	ZParams_MAX = newZParams("MAX")
)
View Source
var (
	BitOP_AND = newBitOP("AND")
	BitOP_OR  = newBitOP("OR")
	BitOP_XOR = newBitOP("XOR")
	BitOP_NOT = newBitOP("NOT")
)
View Source
var (
	Reset_SOFT = newReset("SOFT")
	Reset_HARD = newReset("HARD")
)
View Source
var (
	BYTES_TRUE  = []byte{1}
	BYTES_FALSE = []byte{0}
	BYTES_TILDE = []byte("~")

	POSITIVE_INFINITY_BYTES = []byte("+inf")
	NEGATIVE_INFINITY_BYTES = []byte("-inf")
)
View Source
var (
	CMD_PING                 = newProtocolCommand("PING")
	CMD_SET                  = newProtocolCommand("SET")
	CMD_GET                  = newProtocolCommand("GET")
	CMD_QUIT                 = newProtocolCommand("QUIT")
	CMD_EXISTS               = newProtocolCommand("EXISTS")
	CMD_DEL                  = newProtocolCommand("DEL")
	CMD_UNLINK               = newProtocolCommand("UNLINK")
	CMD_TYPE                 = newProtocolCommand("TYPE")
	CMD_FLUSHDB              = newProtocolCommand("FLUSHDB")
	CMD_KEYS                 = newProtocolCommand("KEYS")
	CMD_RANDOMKEY            = newProtocolCommand("RANDOMKEY")
	CMD_RENAME               = newProtocolCommand("RENAME")
	CMD_RENAMENX             = newProtocolCommand("RENAMENX")
	CMD_RENAMEX              = newProtocolCommand("RENAMEX")
	CMD_DBSIZE               = newProtocolCommand("DBSIZE")
	CMD_EXPIRE               = newProtocolCommand("EXPIRE")
	CMD_EXPIREAT             = newProtocolCommand("EXPIREAT")
	CMD_TTL                  = newProtocolCommand("TTL")
	CMD_SELECT               = newProtocolCommand("SELECT")
	CMD_MOVE                 = newProtocolCommand("MOVE")
	CMD_FLUSHALL             = newProtocolCommand("FLUSHALL")
	CMD_GETSET               = newProtocolCommand("GETSET")
	CMD_MGET                 = newProtocolCommand("MGET")
	CMD_SETNX                = newProtocolCommand("SETNX")
	CMD_SETEX                = newProtocolCommand("SETEX")
	CMD_MSET                 = newProtocolCommand("MSET")
	CMD_MSETNX               = newProtocolCommand("MSETNX")
	CMD_DECRBY               = newProtocolCommand("DECRBY")
	CMD_DECR                 = newProtocolCommand("DECR")
	CMD_INCRBY               = newProtocolCommand("INCRBY")
	CMD_INCR                 = newProtocolCommand("INCR")
	CMD_APPEND               = newProtocolCommand("APPEND")
	CMD_SUBSTR               = newProtocolCommand("SUBSTR")
	CMD_HSET                 = newProtocolCommand("HSET")
	CMD_HGET                 = newProtocolCommand("HGET")
	CMD_HSETNX               = newProtocolCommand("HSETNX")
	CMD_HMSET                = newProtocolCommand("HMSET")
	CMD_HMGET                = newProtocolCommand("HMGET")
	CMD_HINCRBY              = newProtocolCommand("HINCRBY")
	CMD_HEXISTS              = newProtocolCommand("HEXISTS")
	CMD_HDEL                 = newProtocolCommand("HDEL")
	CMD_HLEN                 = newProtocolCommand("HLEN")
	CMD_HKEYS                = newProtocolCommand("HKEYS")
	CMD_HVALS                = newProtocolCommand("HVALS")
	CMD_HGETALL              = newProtocolCommand("HGETALL")
	CMD_RPUSH                = newProtocolCommand("RPUSH")
	CMD_LPUSH                = newProtocolCommand("LPUSH")
	CMD_LLEN                 = newProtocolCommand("LLEN")
	CMD_LRANGE               = newProtocolCommand("LRANGE")
	CMD_LTRIM                = newProtocolCommand("LTRIM")
	CMD_LINDEX               = newProtocolCommand("LINDEX")
	CMD_LSET                 = newProtocolCommand("LSET")
	CMD_LREM                 = newProtocolCommand("LREM")
	CMD_LPOP                 = newProtocolCommand("LPOP")
	CMD_RPOP                 = newProtocolCommand("RPOP")
	CMD_RPOPLPUSH            = newProtocolCommand("RPOPLPUSH")
	CMD_SADD                 = newProtocolCommand("SADD")
	CMD_SMEMBERS             = newProtocolCommand("SMEMBERS")
	CMD_SREM                 = newProtocolCommand("SREM")
	CMD_SPOP                 = newProtocolCommand("SPOP")
	CMD_SMOVE                = newProtocolCommand("SMOVE")
	CMD_SCARD                = newProtocolCommand("SCARD")
	CMD_SISMEMBER            = newProtocolCommand("SISMEMBER")
	CMD_SINTER               = newProtocolCommand("SINTER")
	CMD_SINTERSTORE          = newProtocolCommand("SINTERSTORE")
	CMD_SUNION               = newProtocolCommand("SUNION")
	CMD_SUNIONSTORE          = newProtocolCommand("SUNIONSTORE")
	CMD_SDIFF                = newProtocolCommand("SDIFF")
	CMD_SDIFFSTORE           = newProtocolCommand("SDIFFSTORE")
	CMD_SRANDMEMBER          = newProtocolCommand("SRANDMEMBER")
	CMD_ZADD                 = newProtocolCommand("ZADD")
	CMD_ZRANGE               = newProtocolCommand("ZRANGE")
	CMD_ZREM                 = newProtocolCommand("ZREM")
	CMD_ZINCRBY              = newProtocolCommand("ZINCRBY")
	CMD_ZRANK                = newProtocolCommand("ZRANK")
	CMD_ZREVRANK             = newProtocolCommand("ZREVRANK")
	CMD_ZREVRANGE            = newProtocolCommand("ZREVRANGE")
	CMD_ZCARD                = newProtocolCommand("ZCARD")
	CMD_ZSCORE               = newProtocolCommand("ZSCORE")
	CMD_MULTI                = newProtocolCommand("MULTI")
	CMD_DISCARD              = newProtocolCommand("DISCARD")
	CMD_EXEC                 = newProtocolCommand("EXEC")
	CMD_WATCH                = newProtocolCommand("WATCH")
	CMD_UNWATCH              = newProtocolCommand("UNWATCH")
	CMD_SORT                 = newProtocolCommand("SORT")
	CMD_BLPOP                = newProtocolCommand("BLPOP")
	CMD_BRPOP                = newProtocolCommand("BRPOP")
	CMD_AUTH                 = newProtocolCommand("AUTH")
	CMD_SUBSCRIBE            = newProtocolCommand("SUBSCRIBE")
	CMD_PUBLISH              = newProtocolCommand("PUBLISH")
	CMD_UNSUBSCRIBE          = newProtocolCommand("UNSUBSCRIBE")
	CMD_PSUBSCRIBE           = newProtocolCommand("PSUBSCRIBE")
	CMD_PUNSUBSCRIBE         = newProtocolCommand("PUNSUBSCRIBE")
	CMD_PUBSUB               = newProtocolCommand("PUBSUB")
	CMD_ZCOUNT               = newProtocolCommand("ZCOUNT")
	CMD_ZRANGEBYSCORE        = newProtocolCommand("ZRANGEBYSCORE")
	CMD_ZREVRANGEBYSCORE     = newProtocolCommand("ZREVRANGEBYSCORE")
	CMD_ZREMRANGEBYRANK      = newProtocolCommand("ZREMRANGEBYRANK")
	CMD_ZREMRANGEBYSCORE     = newProtocolCommand("ZREMRANGEBYSCORE")
	CMD_ZUNIONSTORE          = newProtocolCommand("ZUNIONSTORE")
	CMD_ZINTERSTORE          = newProtocolCommand("ZINTERSTORE")
	CMD_ZLEXCOUNT            = newProtocolCommand("ZLEXCOUNT")
	CMD_ZRANGEBYLEX          = newProtocolCommand("ZRANGEBYLEX")
	CMD_ZREVRANGEBYLEX       = newProtocolCommand("ZREVRANGEBYLEX")
	CMD_ZREMRANGEBYLEX       = newProtocolCommand("ZREMRANGEBYLEX")
	CMD_SAVE                 = newProtocolCommand("SAVE")
	CMD_BGSAVE               = newProtocolCommand("BGSAVE")
	CMD_BGREWRITEAOF         = newProtocolCommand("BGREWRITEAOF")
	CMD_LASTSAVE             = newProtocolCommand("LASTSAVE")
	CMD_SHUTDOWN             = newProtocolCommand("SHUTDOWN")
	CMD_INFO                 = newProtocolCommand("INFO")
	CMD_MONITOR              = newProtocolCommand("MONITOR")
	CMD_SLAVEOF              = newProtocolCommand("SLAVEOF")
	CMD_CONFIG               = newProtocolCommand("CONFIG")
	CMD_STRLEN               = newProtocolCommand("STRLEN")
	CMD_SYNC                 = newProtocolCommand("SYNC")
	CMD_LPUSHX               = newProtocolCommand("LPUSHX")
	CMD_PERSIST              = newProtocolCommand("PERSIST")
	CMD_RPUSHX               = newProtocolCommand("RPUSHX")
	CMD_ECHO                 = newProtocolCommand("ECHO")
	CMD_LINSERT              = newProtocolCommand("LINSERT")
	CMD_DEBUG                = newProtocolCommand("DEBUG")
	CMD_BRPOPLPUSH           = newProtocolCommand("BRPOPLPUSH")
	CMD_SETBIT               = newProtocolCommand("SETBIT")
	CMD_GETBIT               = newProtocolCommand("GETBIT")
	CMD_BITPOS               = newProtocolCommand("BITPOS")
	CMD_SETRANGE             = newProtocolCommand("SETRANGE")
	CMD_GETRANGE             = newProtocolCommand("GETRANGE")
	CMD_EVAL                 = newProtocolCommand("EVAL")
	CMD_EVALSHA              = newProtocolCommand("EVALSHA")
	CMD_SCRIPT               = newProtocolCommand("SCRIPT")
	CMD_SLOWLOG              = newProtocolCommand("SLOWLOG")
	CMD_OBJECT               = newProtocolCommand("OBJECT")
	CMD_BITCOUNT             = newProtocolCommand("BITCOUNT")
	CMD_BITOP                = newProtocolCommand("BITOP")
	CMD_SENTINEL             = newProtocolCommand("SENTINEL")
	CMD_DUMP                 = newProtocolCommand("DUMP")
	CMD_RESTORE              = newProtocolCommand("RESTORE")
	CMD_PEXPIRE              = newProtocolCommand("PEXPIRE")
	CMD_PEXPIREAT            = newProtocolCommand("PEXPIREAT")
	CMD_PTTL                 = newProtocolCommand("PTTL")
	CMD_INCRBYFLOAT          = newProtocolCommand("INCRBYFLOAT")
	CMD_PSETEX               = newProtocolCommand("PSETEX")
	CMD_CLIENT               = newProtocolCommand("CLIENT")
	CMD_TIME                 = newProtocolCommand("TIME")
	CMD_MIGRATE              = newProtocolCommand("MIGRATE")
	CMD_HINCRBYFLOAT         = newProtocolCommand("HINCRBYFLOAT")
	CMD_SCAN                 = newProtocolCommand("SCAN")
	CMD_HSCAN                = newProtocolCommand("HSCAN")
	CMD_SSCAN                = newProtocolCommand("SSCAN")
	CMD_ZSCAN                = newProtocolCommand("ZSCAN")
	CMD_WAIT                 = newProtocolCommand("WAIT")
	CMD_CLUSTER              = newProtocolCommand("CLUSTER")
	CMD_ASKING               = newProtocolCommand("ASKING")
	CMD_PFADD                = newProtocolCommand("PFADD")
	CMD_PFCOUNT              = newProtocolCommand("PFCOUNT")
	CMD_PFMERGE              = newProtocolCommand("PFMERGE")
	CMD_READONLY             = newProtocolCommand("READONLY")
	CMD_GEOADD               = newProtocolCommand("GEOADD")
	CMD_GEODIST              = newProtocolCommand("GEODIST")
	CMD_GEOHASH              = newProtocolCommand("GEOHASH")
	CMD_GEOPOS               = newProtocolCommand("GEOPOS")
	CMD_GEORADIUS            = newProtocolCommand("GEORADIUS")
	CMD_GEORADIUS_RO         = newProtocolCommand("GEORADIUS_RO")
	CMD_GEORADIUSBYMEMBER    = newProtocolCommand("GEORADIUSBYMEMBER")
	CMD_GEORADIUSBYMEMBER_RO = newProtocolCommand("GEORADIUSBYMEMBER_RO")
	CMD_MODULE               = newProtocolCommand("MODULE")
	CMD_BITFIELD             = newProtocolCommand("BITFIELD")
	CMD_HSTRLEN              = newProtocolCommand("HSTRLEN")
	CMD_TOUCH                = newProtocolCommand("TOUCH")
	CMD_SWAPDB               = newProtocolCommand("SWAPDB")
	CMD_MEMORY               = newProtocolCommand("MEMORY")
	CMD_XADD                 = newProtocolCommand("XADD")
	CMD_XLEN                 = newProtocolCommand("XLEN")
	CMD_XDEL                 = newProtocolCommand("XDEL")
	CMD_XTRIM                = newProtocolCommand("XTRIM")
	CMD_XRANGE               = newProtocolCommand("XRANGE")
	CMD_XREVRANGE            = newProtocolCommand("XREVRANGE")
	CMD_XREAD                = newProtocolCommand("XREAD")
	CMD_XACK                 = newProtocolCommand("XACK")
	CMD_XGROUP               = newProtocolCommand("XGROUP")
	CMD_XREADGROUP           = newProtocolCommand("XREADGROUP")
	CMD_XPENDING             = newProtocolCommand("XPENDING")
	CMD_XCLAIM               = newProtocolCommand("XCLAIM")
)
View Source
var (
	KEYWORD_AGGREGATE    = newKeyword("AGGREGATE")
	KEYWORD_ALPHA        = newKeyword("ALPHA")
	KEYWORD_ASC          = newKeyword("ASC")
	KEYWORD_BY           = newKeyword("BY")
	KEYWORD_DESC         = newKeyword("DESC")
	KEYWORD_GET          = newKeyword("GET")
	KEYWORD_LIMIT        = newKeyword("LIMIT")
	KEYWORD_MESSAGE      = newKeyword("MESSAGE")
	KEYWORD_NO           = newKeyword("NO")
	KEYWORD_NOSORT       = newKeyword("NOSORT")
	KEYWORD_PMESSAGE     = newKeyword("PMESSAGE")
	KEYWORD_PSUBSCRIBE   = newKeyword("PSUBSCRIBE")
	KEYWORD_PUNSUBSCRIBE = newKeyword("PUNSUBSCRIBE")
	KEYWORD_OK           = newKeyword("OK")
	KEYWORD_ONE          = newKeyword("ONE")
	KEYWORD_QUEUED       = newKeyword("QUEUED")
	KEYWORD_SET          = newKeyword("SET")
	KEYWORD_STORE        = newKeyword("STORE")
	KEYWORD_SUBSCRIBE    = newKeyword("SUBSCRIBE")
	KEYWORD_UNSUBSCRIBE  = newKeyword("UNSUBSCRIBE")
	KEYWORD_WEIGHTS      = newKeyword("WEIGHTS")
	KEYWORD_WITHSCORES   = newKeyword("WITHSCORES")
	KEYWORD_RESETSTAT    = newKeyword("RESETSTAT")
	KEYWORD_REWRITE      = newKeyword("REWRITE")
	KEYWORD_RESET        = newKeyword("RESET")
	KEYWORD_FLUSH        = newKeyword("FLUSH")
	KEYWORD_EXISTS       = newKeyword("EXISTS")
	KEYWORD_LOAD         = newKeyword("LOAD")
	KEYWORD_KILL         = newKeyword("KILL")
	KEYWORD_LEN          = newKeyword("LEN")
	KEYWORD_REFCOUNT     = newKeyword("REFCOUNT")
	KEYWORD_ENCODING     = newKeyword("ENCODING")
	KEYWORD_IDLETIME     = newKeyword("IDLETIME")
	KEYWORD_GETNAME      = newKeyword("GETNAME")
	KEYWORD_SETNAME      = newKeyword("SETNAME")
	KEYWORD_LIST         = newKeyword("LIST")
	KEYWORD_MATCH        = newKeyword("MATCH")
	KEYWORD_COUNT        = newKeyword("COUNT")
	KEYWORD_PING         = newKeyword("PING")
	KEYWORD_PONG         = newKeyword("PONG")
	KEYWORD_UNLOAD       = newKeyword("UNLOAD")
	KEYWORD_REPLACE      = newKeyword("REPLACE")
	KEYWORD_KEYS         = newKeyword("KEYS")
	KEYWORD_PAUSE        = newKeyword("PAUSE")
	KEYWORD_DOCTOR       = newKeyword("DOCTOR")
	KEYWORD_BLOCK        = newKeyword("BLOCK")
	KEYWORD_NOACK        = newKeyword("NOACK")
	KEYWORD_STREAMS      = newKeyword("STREAMS")
	KEYWORD_KEY          = newKeyword("KEY")
	KEYWORD_CREATE       = newKeyword("CREATE")
	KEYWORD_MKSTREAM     = newKeyword("MKSTREAM")
	KEYWORD_SETID        = newKeyword("SETID")
	KEYWORD_DESTROY      = newKeyword("DESTROY")
	KEYWORD_DELCONSUMER  = newKeyword("DELCONSUMER")
	KEYWORD_MAXLEN       = newKeyword("MAXLEN")
	KEYWORD_GROUP        = newKeyword("GROUP")
	KEYWORD_IDLE         = newKeyword("IDLE")
	KEYWORD_TIME         = newKeyword("TIME")
	KEYWORD_RETRYCOUNT   = newKeyword("RETRYCOUNT")
	KEYWORD_FORCE        = newKeyword("FORCE")
)
View Source
var LOOKUP_TABLE = []uint16{}/* 256 elements not displayed */

Functions

func BoolToByteArray

func BoolToByteArray(a bool) []byte

func ByteArrayToFloat64

func ByteArrayToFloat64(bytes []byte) float64

func ByteArrayToInt

func ByteArrayToInt(bytes []byte) uint64

func ByteToStringReply

func ByteToStringReply(reply []byte, err error) (string, error)

func Float64ToByteArray

func Float64ToByteArray(a float64) []byte

func Int64ToBoolReply

func Int64ToBoolReply(reply int64, err error) (bool, error)

func Int64ToByteArray

func Int64ToByteArray(a int64) []byte

func IntToByteArray

func IntToByteArray(a int) []byte

func ObjectArrToMapArrayReply

func ObjectArrToMapArrayReply(reply []interface{}, err error) ([]map[string]string, error)

func ObjectToEvalResult

func ObjectToEvalResult(reply interface{}, err error) (interface{}, error)

func StringArrayToByteArray

func StringArrayToByteArray(arr []string) [][]byte

func StringArrayToMapReply

func StringArrayToMapReply(reply []string, err error) (map[string]string, error)

func StringStringArrayToByteArray

func StringStringArrayToByteArray(str string, arr []string) [][]byte

func StringStringArrayToStringArray

func StringStringArrayToStringArray(str string, arr []string) []string

func StringToFloat64Reply

func StringToFloat64Reply(reply string, err error) (float64, error)

func ToBoolArrayReply

func ToBoolArrayReply(reply interface{}, err error) ([]bool, error)

func ToBoolReply

func ToBoolReply(reply interface{}, err error) (bool, error)

func ToFloat64Reply

func ToFloat64Reply(reply interface{}, err error) (float64, error)

func ToInt64ArrayReply

func ToInt64ArrayReply(reply interface{}, err error) ([]int64, error)

func ToInt64Reply

func ToInt64Reply(reply interface{}, err error) (int64, error)

func ToMapReply

func ToMapReply(reply interface{}, err error) (map[string]string, error)

func ToStringArrayReply

func ToStringArrayReply(reply interface{}, err error) ([]string, error)

func ToStringReply

func ToStringReply(reply interface{}, err error) (string, error)

<editor-fold desc="cluster reply convert">

Types

type AdvancedRedisCommands

type AdvancedRedisCommands interface {
	ConfigGet(pattern string) ([]string, error)
	ConfigSet(parameter string, value string) (string, error)
	SlowlogReset() (string, error)
	SlowlogLen() (int64, error)
	//SlowlogGet() ([]Slowlog, error)
	SlowlogGet(entries ...int64) ([]Slowlog, error)
	ObjectRefcount(str string) (int64, error)
	ObjectEncoding(str string) (string, error)
	ObjectIdletime(str string) (int64, error)
}

type BasicCommands

type BasicCommands interface {
	Ping() (string, error)
	Quit() (string, error)
	FlushDB() (string, error)
	DbSize() (int64, error)
	Select(index int) (string, error)
	FlushAll() (string, error)
	Auth(password string) (string, error)
	Save() (string, error)
	Bgsave() (string, error)
	Bgrewriteaof() (string, error)
	Lastsave() (int64, error)
	Shutdown() (string, error)
	//Info() (string, error)
	Info(section ...string) (string, error)
	Slaveof(host string, port int) (string, error)
	SlaveofNoOne() (string, error)
	GetDB() int
	Debug(params DebugParams) (string, error)
	ConfigResetStat() (string, error)
	WaitReplicas(replicas int, timeout int64) (int64, error)
}

type BasicRedisPipeline

type BasicRedisPipeline interface {
	Bgrewriteaof() (*Response, error)
	Bgsave() (*Response, error)
	ConfigGet(pattern string) (*Response, error)
	ConfigSet(parameter, value string) (*Response, error)
	ConfigResetStat() (*Response, error)
	Save() (*Response, error)
	Lastsave() (*Response, error)
	FlushDB() (*Response, error)
	FlushAll() (*Response, error)
	Info() (*Response, error)
	Time() (*Response, error)
	DbSize() (*Response, error)
	Shutdown() (*Response, error)
	Ping() (*Response, error)
	Select(index int) (*Response, error)
}

type BitOP

type BitOP struct {
	Name string
}

func (BitOP) GetRaw

func (g BitOP) GetRaw() []byte

type BitPosParams

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

type Builder

type Builder interface {
	// contains filtered or unexported methods
}

type CRC16

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

*

  • CRC16 Implementation according to CCITT standard Polynomial : 1021 (x^16 + x^12 + x^5 + 1) See <a
  • href="http://redis.io/topics/cluster-spec">Appendix A. CRC16 reference implementation in ANSI
  • C</a>

func NewCRC16

func NewCRC16() *CRC16

type Client

type Client struct {
	*Connection
	//Host              string
	//Port              int
	//ConnectionTimeout int
	//SoTimeout         int
	Password  string
	Db        int
	IsInMulti bool
	IsInWatch bool
}

func NewClient

func NewClient(shardInfo ShardInfo) *Client

func (*Client) Append

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

func (*Client) Asking

func (c *Client) Asking() error

func (*Client) Auth

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

func (*Client) Bgrewriteaof

func (c *Client) Bgrewriteaof() error

func (*Client) Bgsave

func (c *Client) Bgsave() error

func (*Client) Bitcount

func (c *Client) Bitcount(key string) error

func (*Client) BitcountRange

func (c *Client) BitcountRange(key string, start, end int64) error

func (*Client) Bitfield

func (c *Client) Bitfield(key string, arguments ...string) error

func (*Client) Bitop

func (c *Client) Bitop(op BitOP, destKey string, srcKeys ...string) error

func (*Client) Bitpos

func (c *Client) Bitpos(key string, value bool, params ...BitPosParams) error

func (*Client) Blpop

func (c *Client) Blpop(args []string) error

func (*Client) BlpopTimout

func (c *Client) BlpopTimout(timeout int, keys ...string) error

func (*Client) Brpop

func (c *Client) Brpop(args []string) error

func (*Client) BrpopTimout

func (c *Client) BrpopTimout(timeout int, keys ...string) error

func (*Client) Brpoplpush

func (c *Client) Brpoplpush(source, destination string, timeout int) error

func (*Client) ClientGetname

func (c *Client) ClientGetname() error

func (*Client) ClientKill

func (c *Client) ClientKill(client string) error

func (*Client) ClientList

func (c *Client) ClientList() error

func (*Client) ClientSetname

func (c *Client) ClientSetname(name string) error

func (*Client) Close

func (c *Client) Close() error

func (*Client) Cluster

func (c *Client) Cluster(args ...[]byte) error

func (*Client) ClusterAddSlots

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

func (*Client) ClusterCountKeysInSlot

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

func (*Client) ClusterDelSlots

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

func (*Client) ClusterFailover

func (c *Client) ClusterFailover() error

func (*Client) ClusterFlushSlots

func (c *Client) ClusterFlushSlots() error

func (*Client) ClusterForget

func (c *Client) ClusterForget(nodeId string) error

func (*Client) ClusterGetKeysInSlot

func (c *Client) ClusterGetKeysInSlot(slot int, count int) error

func (*Client) ClusterInfo

func (c *Client) ClusterInfo() error

func (*Client) ClusterKeySlot

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

func (*Client) ClusterMeet

func (c *Client) ClusterMeet(ip string, port int) error

func (*Client) ClusterNodes

func (c *Client) ClusterNodes() error

func (*Client) ClusterReplicate

func (c *Client) ClusterReplicate(nodeId string) error

func (*Client) ClusterReset

func (c *Client) ClusterReset(resetType Reset) error

func (*Client) ClusterSaveConfig

func (c *Client) ClusterSaveConfig() error

func (*Client) ClusterSetSlotImporting

func (c *Client) ClusterSetSlotImporting(slot int, nodeId string) error

func (*Client) ClusterSetSlotMigrating

func (c *Client) ClusterSetSlotMigrating(slot int, nodeId string) error

func (*Client) ClusterSetSlotNode

func (c *Client) ClusterSetSlotNode(slot int, nodeId string) error

func (*Client) ClusterSetSlotStable

func (c *Client) ClusterSetSlotStable(slot int) error

func (*Client) ClusterSlaves

func (c *Client) ClusterSlaves(nodeId string) error

func (*Client) ClusterSlots

func (c *Client) ClusterSlots() error

func (*Client) ConfigGet

func (c *Client) ConfigGet(pattern string) error

func (*Client) ConfigResetStat

func (c *Client) ConfigResetStat() error

func (*Client) ConfigSet

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

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) DbSize

func (c *Client) DbSize() error

func (*Client) Debug

func (c *Client) Debug(params DebugParams) error

func (*Client) Decr

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

func (*Client) DecrBy

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

func (*Client) Del

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

func (*Client) Discard

func (c *Client) Discard() error

func (*Client) Dump

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

func (*Client) Echo

func (c *Client) Echo(string string) error

func (*Client) Eval

func (c *Client) Eval(script string, keyCount int, params ...string) error

func (*Client) Evalsha

func (c *Client) Evalsha(sha1 string, keyCount int, params ...string) error

func (*Client) Exec

func (c *Client) Exec() error

func (*Client) Exists

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

func (*Client) Expire

func (c *Client) Expire(key string, seconds int) error

func (*Client) ExpireAt

func (c *Client) ExpireAt(key string, unixTime int64) error

func (*Client) FlushAll

func (c *Client) FlushAll() error

func (*Client) FlushDB

func (c *Client) FlushDB() error

func (*Client) Geoadd

func (c *Client) Geoadd(key string, longitude, latitude float64, member string) error

func (*Client) GeoaddByMap

func (c *Client) GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) error

func (*Client) Geodist

func (c *Client) Geodist(key, member1, member2 string, unit ...GeoUnit) error

func (*Client) Geohash

func (c *Client) Geohash(key string, members ...string) error

func (*Client) Geopos

func (c *Client) Geopos(key string, members ...string) error

func (*Client) Georadius

func (c *Client) Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, param ...GeoRadiusParam) error

func (*Client) GeoradiusByMember

func (c *Client) GeoradiusByMember(key, member string, radius float64, unit GeoUnit, param ...GeoRadiusParam) error

func (*Client) Get

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

func (*Client) GetDB

func (c *Client) GetDB() int

func (*Client) GetSet

func (c *Client) GetSet(key, value string) error

func (*Client) Getbit

func (c *Client) Getbit(key string, offset int64) error

func (*Client) Getrange

func (c *Client) Getrange(key string, startOffset, endOffset int64) error

func (*Client) Hdel

func (c *Client) Hdel(key string, fields ...string) error

func (*Client) Hexists

func (c *Client) Hexists(key, field string) error

func (*Client) Hget

func (c *Client) Hget(key, field string) error

func (*Client) HgetAll

func (c *Client) HgetAll(key string) error

func (*Client) HincrBy

func (c *Client) HincrBy(key, field string, increment int64) error

func (*Client) HincrByFloat

func (c *Client) HincrByFloat(key, field string, increment float64) error

func (*Client) Hkeys

func (c *Client) Hkeys(key string) error

func (*Client) Hlen

func (c *Client) Hlen(key string) error

func (*Client) Hmget

func (c *Client) Hmget(key string, fields ...string) error

func (*Client) Hmset

func (c *Client) Hmset(key string, hash map[string]string) error

func (*Client) Host

func (c *Client) Host() string

func (*Client) Hscan

func (c *Client) Hscan(key, cursor string, params ...ScanParams) error

func (*Client) Hset

func (c *Client) Hset(key, field, value string) error

func (*Client) Hsetnx

func (c *Client) Hsetnx(key, field, value string) error

func (*Client) Hvals

func (c *Client) Hvals(key string) error

func (*Client) Incr

func (c *Client) Incr(key string) error

func (*Client) IncrBy

func (c *Client) IncrBy(key string, increment int64) error

func (*Client) IncrByFloat

func (c *Client) IncrByFloat(key string, increment float64) error

func (*Client) Info

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

func (*Client) Keys

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

func (*Client) Lastsave

func (c *Client) Lastsave() error

func (*Client) Lindex

func (c *Client) Lindex(key string, index int64) error

func (*Client) Linsert

func (c *Client) Linsert(key string, where ListOption, pivot, value string) error

func (*Client) Llen

func (c *Client) Llen(key string) error

func (*Client) Lpop

func (c *Client) Lpop(key string) error

func (*Client) Lpush

func (c *Client) Lpush(key string, fields ...string) error

func (*Client) Lpushx

func (c *Client) Lpushx(key string, string ...string) error

func (*Client) Lrange

func (c *Client) Lrange(key string, start, end int64) error

func (*Client) Lrem

func (c *Client) Lrem(key string, count int64, value string) error

func (*Client) Lset

func (c *Client) Lset(key string, index int64, value string) error

func (*Client) Ltrim

func (c *Client) Ltrim(key string, start, end int64) error

func (*Client) Mget

func (c *Client) Mget(keys ...string) error

func (*Client) Migrate

func (c *Client) Migrate(host string, port int, key string, destinationDb int, timeout int) error

func (*Client) Move

func (c *Client) Move(key string, dbIndex int) error

func (*Client) Mset

func (c *Client) Mset(keysvalues ...string) error

func (*Client) Msetnx

func (c *Client) Msetnx(keysvalues ...string) error

func (*Client) Multi

func (c *Client) Multi() error

func (*Client) ObjectEncoding

func (c *Client) ObjectEncoding(str string) error

func (*Client) ObjectIdletime

func (c *Client) ObjectIdletime(str string) error

func (*Client) ObjectRefcount

func (c *Client) ObjectRefcount(str string) error

func (*Client) Persist

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

func (*Client) Pexpire

func (c *Client) Pexpire(key string, milliseconds int64) error

func (*Client) PexpireAt

func (c *Client) PexpireAt(key string, unixTime int64) error

func (*Client) Pfadd

func (c *Client) Pfadd(key string, elements ...string) error

func (*Client) Pfcount

func (c *Client) Pfcount(keys ...string) error

func (*Client) Pfmerge

func (c *Client) Pfmerge(destkey string, sourcekeys ...string) error

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) Port

func (c *Client) Port() int

func (*Client) Psetex

func (c *Client) Psetex(key string, milliseconds int64, value string) error

func (*Client) Psubscribe

func (c *Client) Psubscribe(patterns ...string) error

func (*Client) Pttl

func (c *Client) Pttl(key string) error

func (*Client) Publish

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

func (*Client) Pubsub

func (c *Client) Pubsub(subcommand string, args ...string) error

func (*Client) PubsubChannels

func (c *Client) PubsubChannels(pattern string) error

func (*Client) Punsubscribe

func (c *Client) Punsubscribe(patterns ...string) error

func (*Client) Quit

func (c *Client) Quit() error

func (*Client) RandomKey

func (c *Client) RandomKey() error

func (*Client) Readonly

func (c *Client) Readonly() error

func (*Client) Rename

func (c *Client) Rename(oldKey, newKey string) error

func (*Client) Renamenx

func (c *Client) Renamenx(oldKey, newKey string) error

func (*Client) Restore

func (c *Client) Restore(key string, ttl int, serializedValue []byte) error

func (*Client) Rpop

func (c *Client) Rpop(key string) error

func (*Client) RpopLpush

func (c *Client) RpopLpush(srckey, dstkey string) error

func (*Client) Rpush

func (c *Client) Rpush(key string, fields ...string) error

func (*Client) Rpushx

func (c *Client) Rpushx(key string, string ...string) error

func (*Client) Sadd

func (c *Client) Sadd(key string, members ...string) error

func (*Client) Save

func (c *Client) Save() error

func (*Client) Scan

func (c *Client) Scan(cursor string, params ...ScanParams) error

func (*Client) Scard

func (c *Client) Scard(key string) error

func (*Client) ScriptExists

func (c *Client) ScriptExists(sha1 ...string) error

func (*Client) ScriptLoad

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

func (*Client) Sdiff

func (c *Client) Sdiff(keys ...string) error

func (*Client) Sdiffstore

func (c *Client) Sdiffstore(dstkey string, keys ...string) error

func (*Client) Select

func (c *Client) Select(index int) error

func (*Client) Sentinel

func (c *Client) Sentinel(args ...string) error

func (*Client) SentinelFailover

func (c *Client) SentinelFailover(masterName string) error

func (*Client) SentinelGetMasterAddrByName

func (c *Client) SentinelGetMasterAddrByName(masterName string) error

func (*Client) SentinelMasters

func (c *Client) SentinelMasters() error

func (*Client) SentinelMonitor

func (c *Client) SentinelMonitor(masterName, ip string, port, quorum int) error

func (*Client) SentinelRemove

func (c *Client) SentinelRemove(masterName string) error

func (*Client) SentinelReset

func (c *Client) SentinelReset(pattern string) error

func (*Client) SentinelSet

func (c *Client) SentinelSet(masterName string, parameterMap map[string]string) error

func (*Client) SentinelSlaves

func (c *Client) SentinelSlaves(masterName string) error

func (*Client) Set

func (c *Client) Set(key, value string) error

func (*Client) SetWithParams

func (c *Client) SetWithParams(key, value, nxxx string) error

func (*Client) SetWithParamsAndTime

func (c *Client) SetWithParamsAndTime(key, value, nxxx, expx string, time int64) error

func (*Client) Setbit

func (c *Client) Setbit(key string, offset int64, value string) error

func (*Client) Setex

func (c *Client) Setex(key string, seconds int, value string) error

func (*Client) Setnx

func (c *Client) Setnx(key, value string) error

func (*Client) Setrange

func (c *Client) Setrange(key string, offset int64, value string) error

func (*Client) Shutdown

func (c *Client) Shutdown() error

func (*Client) Sinter

func (c *Client) Sinter(keys ...string) error

func (*Client) Sinterstore

func (c *Client) Sinterstore(dstkey string, keys ...string) error

func (*Client) Sismember

func (c *Client) Sismember(key, member string) error

func (*Client) Slaveof

func (c *Client) Slaveof(host string, port int) error

func (*Client) SlaveofNoOne

func (c *Client) SlaveofNoOne() error

func (*Client) SlowlogGet

func (c *Client) SlowlogGet(entries ...int64) error

func (*Client) SlowlogLen

func (c *Client) SlowlogLen() error

func (*Client) SlowlogReset

func (c *Client) SlowlogReset() error

func (*Client) Smembers

func (c *Client) Smembers(key string) error

func (*Client) Smove

func (c *Client) Smove(srckey, dstkey, member string) error

func (*Client) Sort

func (c *Client) Sort(key string, sortingParameters ...SortingParams) error

func (*Client) SortMulti

func (c *Client) SortMulti(key, dstkey string, sortingParameters ...SortingParams) error

func (*Client) Spop

func (c *Client) Spop(key string) error

func (*Client) SpopBatch

func (c *Client) SpopBatch(key string, count int64) error

func (*Client) Srandmember

func (c *Client) Srandmember(key string) error

func (*Client) SrandmemberBatch

func (c *Client) SrandmemberBatch(key string, count int) error

func (*Client) Srem

func (c *Client) Srem(key string, members ...string) error

func (*Client) Sscan

func (c *Client) Sscan(key, cursor string, params ...ScanParams) error

func (*Client) Strlen

func (c *Client) Strlen(key string) error

func (*Client) Subscribe

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

func (*Client) Substr

func (c *Client) Substr(key string, start, end int) error

func (*Client) Sunion

func (c *Client) Sunion(keys ...string) error

func (*Client) Sunionstore

func (c *Client) Sunionstore(dstkey string, keys ...string) error

func (*Client) Time

func (c *Client) Time() error

func (*Client) Ttl

func (c *Client) Ttl(key string) error

func (*Client) Type

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

func (*Client) Unsubscribe

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

func (*Client) Unwatch

func (c *Client) Unwatch() error

func (*Client) WaitReplicas

func (c *Client) WaitReplicas(replicas int, timeout int64) error

func (*Client) Watch

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

func (*Client) Zadd

func (c *Client) Zadd(key string, score float64, member string) error

func (*Client) ZaddByMap

func (c *Client) ZaddByMap(key string, scoreMembers map[string]float64, params ...ZAddParams) error

func (*Client) Zcard

func (c *Client) Zcard(key string) error

func (*Client) Zcount

func (c *Client) Zcount(key, min, max string) error

func (*Client) Zincrby

func (c *Client) Zincrby(key string, score float64, member string) error

func (*Client) Zinterstore

func (c *Client) Zinterstore(dstkey string, sets ...string) error

func (*Client) ZinterstoreWithParams

func (c *Client) ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) error

func (*Client) Zlexcount

func (c *Client) Zlexcount(key, min, max string) error

func (*Client) Zrange

func (c *Client) Zrange(key string, start, end int64) error

func (*Client) ZrangeByLex

func (c *Client) ZrangeByLex(key, min, max string) error

func (*Client) ZrangeByLexBatch

func (c *Client) ZrangeByLexBatch(key, min, max string, offset, count int) error

func (*Client) ZrangeByScore

func (c *Client) ZrangeByScore(key, min, max string) error

func (*Client) ZrangeByScoreBatch

func (c *Client) ZrangeByScoreBatch(key, max, min string, offset, count int) error

func (*Client) ZrangeWithScores

func (c *Client) ZrangeWithScores(key string, start, end int64) error

func (*Client) Zrank

func (c *Client) Zrank(key, member string) error

func (*Client) Zrem

func (c *Client) Zrem(key string, members ...string) error

func (*Client) ZremrangeByLex

func (c *Client) ZremrangeByLex(key, min, max string) error

func (*Client) ZremrangeByRank

func (c *Client) ZremrangeByRank(key string, start, end int64) error

func (*Client) ZremrangeByScore

func (c *Client) ZremrangeByScore(key, start, end string) error

func (*Client) Zrevrange

func (c *Client) Zrevrange(key string, start, end int64) error

func (*Client) ZrevrangeByLex

func (c *Client) ZrevrangeByLex(key, max, min string) error

func (*Client) ZrevrangeByLexBatch

func (c *Client) ZrevrangeByLexBatch(key, max, min string, offset, count int) error

func (*Client) ZrevrangeByScore

func (c *Client) ZrevrangeByScore(key, max, min string) error

func (*Client) ZrevrangeByScoreBatch

func (c *Client) ZrevrangeByScoreBatch(key, max, min string, offset, count int) error

func (*Client) ZrevrangeByScoreWithScores

func (c *Client) ZrevrangeByScoreWithScores(key, max, min string) error

func (*Client) ZrevrangeWithScores

func (c *Client) ZrevrangeWithScores(key string, start, end int64) error

func (*Client) Zrevrank

func (c *Client) Zrevrank(key, member string) error

func (*Client) Zscan

func (c *Client) Zscan(key, cursor string, params ...ScanParams) error

func (*Client) Zscore

func (c *Client) Zscore(key, member string) error

func (*Client) Zunionstore

func (c *Client) Zunionstore(dstkey string, sets ...string) error

func (*Client) ZunionstoreWithParams

func (c *Client) ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) error

type ClusterCommands

type ClusterCommands interface {
	ClusterNodes() (string, error)
	ClusterMeet(ip string, port int) (string, error)
	ClusterAddSlots(slots ...int) (string, error)
	ClusterDelSlots(slots ...int) (string, error)
	ClusterInfo() (string, error)
	ClusterGetKeysInSlot(slot int, count int) ([]string, error)
	ClusterSetSlotNode(slot int, nodeId string) (string, error)
	ClusterSetSlotMigrating(slot int, nodeId string) (string, error)
	ClusterSetSlotImporting(slot int, nodeId string) (string, error)
	ClusterSetSlotStable(slot int) (string, error)
	ClusterForget(nodeId string) (string, error)
	ClusterFlushSlots() (string, error)
	ClusterKeySlot(key string) (int64, error)
	ClusterCountKeysInSlot(slot int) (int64, error)
	ClusterSaveConfig() (string, error)
	ClusterReplicate(nodeId string) (string, error)
	ClusterSlaves(nodeId string) ([]string, error)
	ClusterFailover() (string, error)
	ClusterSlots() ([]interface{}, error)
	ClusterReset(resetType Reset) (string, error)
	Readonly() (string, error)
}

type ClusterPipeline

type ClusterPipeline interface {
	ClusterNodes() (*Response, error)
	ClusterMeet(ip string, port int) (*Response, error)
	ClusterAddSlots(slots ...int) (*Response, error)
	ClusterDelSlots(slots ...int) (*Response, error)
	ClusterInfo() (*Response, error)
	ClusterGetKeysInSlot(slot int, count int) (*Response, error)
	ClusterSetSlotNode(slot int, nodeId string) (*Response, error)
	ClusterSetSlotMigrating(slot int, nodeId string) (*Response, error)
	ClusterSetSlotImporting(slot int, nodeId string) (*Response, error)
}

type ClusterScriptingCommands

type ClusterScriptingCommands interface {
	Eval(script string, keyCount int, params ...string) (interface{}, error)
	Evalsha(sha1 string, keyCount int, params ...string) (interface{}, error)
	ScriptExists(key string, sha1 ...string) ([]bool, error)
	ScriptLoad(key, script string) (string, error)
}

type Connection

type Connection struct {
	Host              string
	Port              int
	Socket            net.Conn
	Protocol          *Protocol
	ConnectionTimeout int
	SoTimeout         int
	Broken            bool
	Ssl               bool
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(host string, port, connectionTimeout, soTimeout int, ssl bool) *Connection

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Connect

func (c *Connection) Connect() error

func (*Connection) IsConnected

func (c *Connection) IsConnected() bool

func (*Connection) SendCommand

func (c *Connection) SendCommand(cmd protocolCommand, args ...[]byte) error

type DebugParams

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

type Factory

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

func NewFactory

func NewFactory(shardInfo ShardInfo) *Factory

func (Factory) ActivateObject

func (f Factory) ActivateObject(ctx context.Context, object *pool.PooledObject) error

func (Factory) DestroyObject

func (f Factory) DestroyObject(ctx context.Context, object *pool.PooledObject) error

func (Factory) MakeObject

func (f Factory) MakeObject(ctx context.Context) (*pool.PooledObject, error)

func (Factory) PassivateObject

func (f Factory) PassivateObject(ctx context.Context, object *pool.PooledObject) error

func (Factory) ValidateObject

func (f Factory) ValidateObject(ctx context.Context, object *pool.PooledObject) bool

type GeoCoordinate

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

func ObjectArrToGeoCoordinateReply

func ObjectArrToGeoCoordinateReply(reply []interface{}, err error) ([]*GeoCoordinate, error)

func ToGeoArrayReply

func ToGeoArrayReply(reply interface{}, err error) ([]*GeoCoordinate, error)

type GeoRadiusParam

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

type GeoRadiusResponse

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

type GeoUnit

type GeoUnit struct {
	Name string
}

func (GeoUnit) GetRaw

func (g GeoUnit) GetRaw() []byte

type ListOption

type ListOption struct {
	Name string
}

func (ListOption) GetRaw

func (l ListOption) GetRaw() []byte

type MultiKeyCommands

type MultiKeyCommands interface {
	Del(keys ...string) (int64, error)
	Exists(keys ...string) (int64, error)
	BlpopTimout(timeout int, keys ...string) ([]string, error)
	BrpopTimout(timeout int, keys ...string) ([]string, error)
	Blpop(args ...string) ([]string, error)
	Brpop(args ...string) ([]string, error)
	Keys(pattern string) ([]string, error)
	Mget(keys ...string) ([]string, error)
	Mset(keysvalues ...string) (string, error)
	Msetnx(keysvalues ...string) (int64, error)
	Rename(oldkey, newkey string) (string, error)
	Renamenx(oldkey, newkey string) (int64, error)
	Rpoplpush(srckey, dstkey string) (string, error)
	Sdiff(keys ...string) ([]string, error)

	Sdiffstore(dstkey string, keys ...string) (int64, error)
	Sinter(keys ...string) ([]string, error)
	Sinterstore(dstkey string, keys ...string) (int64, error)
	Smove(srckey, dstkey, member string) (int64, error)
	SortMulti(key string, dstkey string, sortingParameters ...SortingParams) (int64, error)
	//Sort(key, dstkey string) (int64, error)
	Sunion(keys ...string) ([]string, error)
	Sunionstore(dstkey string, keys ...string) (int64, error)
	Watch(keys ...string) (string, error)
	Unwatch() (string, error)
	Zinterstore(dstkey string, sets ...string) (int64, error)
	ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
	Zunionstore(dstkey string, sets ...string) (int64, error)
	ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
	Brpoplpush(source, destination string, timeout int) (string, error)
	Publish(channel, message string) (int64, error)
	Subscribe(redisPubSub *RedisPubSub, channels ...string) error
	Psubscribe(redisPubSub *RedisPubSub, patterns ...string) error
	RandomKey() (string, error)
	Bitop(op BitOP, destKey string, srcKeys ...string) (int64, error)
	//Scan(cursor string) (ScanResult, error)
	Scan(cursor string, params ...ScanParams) (*ScanResult, error)
	Pfmerge(destkey string, sourcekeys ...string) (string, error)
	Pfcount(keys ...string) (int64, error)
}

type MultiKeyCommandsPipeline

type MultiKeyCommandsPipeline interface {
	Del(keys ...string) (*Response, error)
	Exists(keys ...string) (*Response, error)
	BlpopTimout(timeout int, keys ...string) (*Response, error)
	BrpopTimout(timeout int, keys ...string) (*Response, error)
	Blpop(args ...string) (*Response, error)
	Brpop(args ...string) (*Response, error)
	Keys(pattern string) (*Response, error)
	Mget(keys ...string) (*Response, error)
	Mset(keysvalues ...string) (*Response, error)
	Msetnx(keysvalues ...string) (*Response, error)
	Rename(oldkey, newkey string) (*Response, error)
	Renamenx(oldkey, newkey string) (*Response, error)
	Rpoplpush(srckey, dstkey string) (*Response, error)
	Sdiff(keys ...string) (*Response, error)

	Sdiffstore(dstkey string, keys ...string) (*Response, error)
	Sinter(keys ...string) (*Response, error)
	Sinterstore(dstkey string, keys ...string) (*Response, error)
	Smove(srckey, dstkey, member string) (*Response, error)
	SortMulti(key string, dstkey string, sortingParameters ...SortingParams) (*Response, error)
	//Sort(key, dstkey string) (*Response, error)
	Sunion(keys ...string) (*Response, error)
	Sunionstore(dstkey string, keys ...string) (*Response, error)
	Watch(keys ...string) (*Response, error)
	Unwatch() (*Response, error)
	Zinterstore(dstkey string, sets ...string) (*Response, error)
	ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) (*Response, error)
	Zunionstore(dstkey string, sets ...string) (*Response, error)
	ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) (*Response, error)
	Brpoplpush(source, destination string, timeout int) (*Response, error)
	Publish(channel, message string) (*Response, error)
	RandomKey() (*Response, error)
	Bitop(op BitOP, destKey string, srcKeys ...string) (*Response, error)
	//Scan(cursor string) (ScanResult, error)
	Scan(cursor string, params ...ScanParams) (*Response, error)
	Pfmerge(destkey string, sourcekeys ...string) (*Response, error)
	Pfcount(keys ...string) (*Response, error)
}

type MultiKeyPipelineBase

type MultiKeyPipelineBase struct {
	*Queable
	// contains filtered or unexported fields
}

func NewMultiKeyPipelineBase

func NewMultiKeyPipelineBase(client *Client) *MultiKeyPipelineBase

func (*MultiKeyPipelineBase) Bgrewriteaof

func (p *MultiKeyPipelineBase) Bgrewriteaof() (*Response, error)

<editor-fold desc="basicpipeline">

func (*MultiKeyPipelineBase) Bgsave

func (p *MultiKeyPipelineBase) Bgsave() (*Response, error)

func (*MultiKeyPipelineBase) ConfigGet

func (p *MultiKeyPipelineBase) ConfigGet(pattern string) (*Response, error)

func (*MultiKeyPipelineBase) ConfigResetStat

func (p *MultiKeyPipelineBase) ConfigResetStat() (*Response, error)

func (*MultiKeyPipelineBase) ConfigSet

func (p *MultiKeyPipelineBase) ConfigSet(parameter, value string) (*Response, error)

func (*MultiKeyPipelineBase) DbSize

func (p *MultiKeyPipelineBase) DbSize() (*Response, error)

func (*MultiKeyPipelineBase) FlushAll

func (p *MultiKeyPipelineBase) FlushAll() (*Response, error)

func (*MultiKeyPipelineBase) FlushDB

func (p *MultiKeyPipelineBase) FlushDB() (*Response, error)

func (*MultiKeyPipelineBase) Info

func (p *MultiKeyPipelineBase) Info() (*Response, error)

func (*MultiKeyPipelineBase) Lastsave

func (p *MultiKeyPipelineBase) Lastsave() (*Response, error)

func (*MultiKeyPipelineBase) Ping

func (p *MultiKeyPipelineBase) Ping() (*Response, error)

func (*MultiKeyPipelineBase) Save

func (p *MultiKeyPipelineBase) Save() (*Response, error)

func (*MultiKeyPipelineBase) Select

func (p *MultiKeyPipelineBase) Select(index int) (*Response, error)

func (*MultiKeyPipelineBase) Shutdown

func (p *MultiKeyPipelineBase) Shutdown() (*Response, error)

func (*MultiKeyPipelineBase) Time

func (p *MultiKeyPipelineBase) Time() (*Response, error)

type Pipeline

type Pipeline struct {
	*MultiKeyPipelineBase
}

func NewPipeline

func NewPipeline(client *Client) *Pipeline

func (*Pipeline) Sync

func (p *Pipeline) Sync() error

type Pool

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

func NewPool

func NewPool(config PoolConfig, factory *Factory) *Pool

func (*Pool) Destroy

func (p *Pool) Destroy()

func (*Pool) GetResource

func (p *Pool) GetResource() (*Redis, error)

type PoolConfig

type PoolConfig struct {
	MaxTotal             *int
	MaxIdle              *int
	MinIdle              *int
	MinEvictableIdleTime *time.Duration
	TestOnBorrow         *bool
}

type Protocol

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

func NewProtocol

func NewProtocol(os *RedisOutputStream, is *RedisInputStream) *Protocol

type ProtocolCommand

type ProtocolCommand interface {
	GetRaw() []byte
}

type Queable

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

func NewQueable

func NewQueable() *Queable

type Redis

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

Redis redis tool

func NewRedis

func NewRedis(shardInfo ShardInfo) *Redis

func (*Redis) Append

func (r *Redis) Append(key, value string) (int64, error)

*

  • If the key already exists and is a string, this command appends the provided value at the end
  • of the string. If the key does not exist it is created and set as an empty string, so APPEND
  • will be very similar to SET in this special case.
  • <p>
  • Time complexity: O(1). The amortized time complexity is O(1) assuming the appended value is
  • small and the already present value is of any size, since the dynamic string library used by
  • Redis will double the free space available on every reallocation.
  • @param key
  • @param value
  • @return Integer reply, specifically the total length of the string after the append operation.

func (*Redis) Asking

func (r *Redis) Asking() (string, error)

func (*Redis) Auth

func (r *Redis) Auth(password string) (string, error)

func (*Redis) Bgrewriteaof

func (r *Redis) Bgrewriteaof() (string, error)

func (*Redis) Bgsave

func (r *Redis) Bgsave() (string, error)

func (*Redis) Bitcount

func (r *Redis) Bitcount(key string) (int64, error)

func (*Redis) BitcountRange

func (r *Redis) BitcountRange(key string, start, end int64) (int64, error)

func (*Redis) Bitfield

func (r *Redis) Bitfield(key string, arguments ...string) ([]int64, error)

func (*Redis) Bitop

func (r *Redis) Bitop(op BitOP, destKey string, srcKeys ...string) (int64, error)

func (*Redis) Bitpos

func (r *Redis) Bitpos(key string, value bool, params ...BitPosParams) (int64, error)

func (*Redis) Blpop

func (r *Redis) Blpop(args ...string) ([]string, error)

*

  • BLPOP (and BRPOP) is a blocking list pop primitive. You can see this commands as blocking
  • versions of LPOP and RPOP able to block if the specified keys don't exist or contain empty
  • lists.
  • <p>
  • The following is a description of the exact semantic. We describe BLPOP but the two commands
  • are identical, the only difference is that BLPOP pops the element from the left (head) of the
  • list, and BRPOP pops from the right (tail).
  • <p>
  • <b>Non blocking behavior</b>
  • <p>
  • When BLPOP is called, if at least one of the specified keys contain a non empty list, an
  • element is popped from the head of the list and returned to the caller together with the name
  • of the key (BLPOP returns a two elements array, the first element is the key, the second the
  • popped value).
  • <p>
  • Keys are scanned from left to right, so for instance if you issue BLPOP list1 list2 list3 0
  • against a dataset where list1 does not exist but list2 and list3 contain non empty lists, BLPOP
  • guarantees to return an element from the list stored at list2 (since it is the first non empty
  • list starting from the left).
  • <p>
  • <b>Blocking behavior</b>
  • <p>
  • If none of the specified keys exist or contain non empty lists, BLPOP blocks until some other
  • client performs a LPUSH or an RPUSH operation against one of the lists.
  • <p>
  • Once new data is present on one of the lists, the client finally returns with the name of the
  • key unblocking it and the popped value.
  • <p>
  • When blocking, if a non-zero timeout is specified, the client will unblock returning a nil
  • special value if the specified amount of seconds passed without a push operation against at
  • least one of the specified keys.
  • <p>
  • The timeout argument is interpreted as an integer value. A timeout of zero means instead to
  • block forever.
  • <p>
  • <b>Multiple clients blocking for the same keys</b>
  • <p>
  • Multiple clients can block for the same key. They are put into a queue, so the first to be
  • served will be the one that started to wait earlier, in a first-blpopping first-served fashion.
  • <p>
  • <b>blocking POP inside a MULTI/EXEC transaction</b>
  • <p>
  • BLPOP and BRPOP can be used with pipelining (sending multiple commands and reading the replies
  • in batch), but it does not make sense to use BLPOP or BRPOP inside a MULTI/EXEC block (a Redis
  • transaction).
  • <p>
  • The behavior of BLPOP inside MULTI/EXEC when the list is empty is to return a multi-bulk nil
  • reply, exactly what happens when the timeout is reached. If you like science fiction, think at
  • it like if inside MULTI/EXEC the time will flow at infinite speed :)
  • <p>
  • Time complexity: O(1)
  • @see #brpop(int, String...)
  • @param timeout
  • @param keys
  • @return BLPOP returns a two-elements array via a multi bulk reply in order to return both the
  • unblocking key and the popped value.
  • <p>
  • When a non-zero timeout is specified, and the BLPOP operation timed out, the return
  • value is a nil multi bulk reply. Most client values will return false or nil
  • accordingly to the programming language used.

func (*Redis) BlpopTimout

func (r *Redis) BlpopTimout(timeout int, keys ...string) ([]string, error)

func (*Redis) Brpop

func (r *Redis) Brpop(args ...string) ([]string, error)

func (*Redis) BrpopTimout

func (r *Redis) BrpopTimout(timeout int, keys ...string) ([]string, error)

func (*Redis) Brpoplpush

func (r *Redis) Brpoplpush(source, destination string, timeout int) (string, error)

func (*Redis) Close

func (r *Redis) Close() error

func (*Redis) ClusterAddSlots

func (r *Redis) ClusterAddSlots(slots ...int) (string, error)

func (*Redis) ClusterCountKeysInSlot

func (r *Redis) ClusterCountKeysInSlot(slot int) (int64, error)

func (*Redis) ClusterDelSlots

func (r *Redis) ClusterDelSlots(slots ...int) (string, error)

func (*Redis) ClusterFailover

func (r *Redis) ClusterFailover() (string, error)

func (*Redis) ClusterFlushSlots

func (r *Redis) ClusterFlushSlots() (string, error)

func (*Redis) ClusterForget

func (r *Redis) ClusterForget(nodeId string) (string, error)

func (*Redis) ClusterGetKeysInSlot

func (r *Redis) ClusterGetKeysInSlot(slot int, count int) ([]string, error)

func (*Redis) ClusterInfo

func (r *Redis) ClusterInfo() (string, error)

func (*Redis) ClusterKeySlot

func (r *Redis) ClusterKeySlot(key string) (int64, error)

func (*Redis) ClusterMeet

func (r *Redis) ClusterMeet(ip string, port int) (string, error)

func (*Redis) ClusterNodes

func (r *Redis) ClusterNodes() (string, error)

<editor-fold desc="clustercommands">

func (*Redis) ClusterReplicate

func (r *Redis) ClusterReplicate(nodeId string) (string, error)

func (*Redis) ClusterReset

func (r *Redis) ClusterReset(resetType Reset) (string, error)

func (*Redis) ClusterSaveConfig

func (r *Redis) ClusterSaveConfig() (string, error)

func (*Redis) ClusterSetSlotImporting

func (r *Redis) ClusterSetSlotImporting(slot int, nodeId string) (string, error)

func (*Redis) ClusterSetSlotMigrating

func (r *Redis) ClusterSetSlotMigrating(slot int, nodeId string) (string, error)

func (*Redis) ClusterSetSlotNode

func (r *Redis) ClusterSetSlotNode(slot int, nodeId string) (string, error)

func (*Redis) ClusterSetSlotStable

func (r *Redis) ClusterSetSlotStable(slot int) (string, error)

func (*Redis) ClusterSlaves

func (r *Redis) ClusterSlaves(nodeId string) ([]string, error)

func (*Redis) ClusterSlots

func (r *Redis) ClusterSlots() ([]interface{}, error)

func (*Redis) ConfigGet

func (r *Redis) ConfigGet(pattern string) ([]string, error)

<editor-fold desc="advancedcommands">

func (*Redis) ConfigResetStat

func (r *Redis) ConfigResetStat() (string, error)

func (*Redis) ConfigSet

func (r *Redis) ConfigSet(parameter, value string) (string, error)

func (*Redis) Connect

func (r *Redis) Connect() error

func (*Redis) DbSize

func (r *Redis) DbSize() (int64, error)

func (*Redis) Debug

func (r *Redis) Debug(params DebugParams) (string, error)

func (*Redis) Decr

func (r *Redis) Decr(key string) (int64, error)

*

  • Decrement the number stored at key by one. If the key does not exist or contains a value of a
  • wrong type, set the key to the value of "0" before to perform the decrement operation.
  • <p>
  • INCR commands are limited to 64 bit signed integers.
  • <p>
  • Note: this is actually a string operation, that is, in Redis there are not "integer" types.
  • Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented,
  • and then converted back as a string.
  • <p>
  • Time complexity: O(1)
  • @see #incr(String)
  • @see #incrBy(String, long)
  • @see #decrBy(String, long)
  • @param key
  • @return Integer reply, this commands will reply with the new value of key after the increment.

func (*Redis) DecrBy

func (r *Redis) DecrBy(key string, decrement int64) (int64, error)

*

  • IDECRBY work just like {@link #decr(String) INCR} but instead to decrement by 1 the decrement
  • is integer.
  • <p>
  • INCR commands are limited to 64 bit signed integers.
  • <p>
  • Note: this is actually a string operation, that is, in Redis there are not "integer" types.
  • Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented,
  • and then converted back as a string.
  • <p>
  • Time complexity: O(1)
  • @see #incr(String)
  • @see #decr(String)
  • @see #incrBy(String, long)
  • @param key
  • @param integer
  • @return Integer reply, this commands will reply with the new value of key after the increment.

func (*Redis) Del

func (r *Redis) Del(key ...string) (int64, error)

*

  • Remove the specified keys. If a given key does not exist no operation is performed for this
  • key. The command returns the number of keys removed. Time complexity: O(1)
  • @param keys
  • @return Integer reply, specifically: an integer greater than 0 if one or more keys were removed
  • 0 if none of the specified key existed

func (*Redis) Echo

func (r *Redis) Echo(string string) (string, error)

Echo Returns message.

Return value Bulk string reply

func (*Redis) Eval

func (r *Redis) Eval(script string, keyCount int, params ...string) (interface{}, error)

<editor-fold desc="scriptcommands">

func (*Redis) Evalsha

func (r *Redis) Evalsha(sha1 string, keyCount int, params ...string) (interface{}, error)

func (*Redis) Exists

func (r *Redis) Exists(keys ...string) (int64, error)

*

  • Test if the specified key exists. The command returns the number of keys existed Time
  • complexity: O(N)
  • @param keys
  • @return Integer reply, specifically: an integer greater than 0 if one or more keys were removed
  • 0 if none of the specified key existed

func (*Redis) Expire

func (r *Redis) Expire(key string, seconds int) (int64, error)

*

  • Set a timeout on the specified key. After the timeout the key will be automatically deleted by
  • the server. A key with an associated timeout is said to be volatile in Redis terminology.
  • <p>
  • Voltile keys are stored on disk like the other keys, the timeout is persistent too like all the
  • other aspects of the dataset. Saving a dataset containing expires and stopping the server does
  • not stop the flow of time as Redis stores on disk the time when the key will no longer be
  • available as Unix time, and not the remaining seconds.
  • <p>
  • Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire
  • set. It is also possible to undo the expire at all turning the key into a normal key using the
  • {@link #persist(String) PERSIST} command.
  • <p>
  • Time complexity: O(1)
  • @see <a href="http://code.google.com/p/redis/wiki/ExpireCommand">ExpireCommand</a>
  • @param key
  • @param seconds
  • @return Integer reply, specifically: 1: the timeout was set. 0: the timeout was not set since
  • the key already has an associated timeout (this may happen only in Redis versions &lt;
  • 2.1.3, Redis &gt;= 2.1.3 will happily update the timeout), or the key does not exist.

func (*Redis) ExpireAt

func (r *Redis) ExpireAt(key string, unixtime int64) (int64, error)

*

  • EXPIREAT works exctly like {@link #expire(String, int) EXPIRE} but instead to get the number of
  • seconds representing the Time To Live of the key as a second argument (that is a relative way
  • of specifing the TTL), it takes an absolute one in the form of a UNIX timestamp (Number of
  • seconds elapsed since 1 Gen 1970).
  • <p>
  • EXPIREAT was introduced in order to implement the Append Only File persistence mode so that
  • EXPIRE commands are automatically translated into EXPIREAT commands for the append only file.
  • Of course EXPIREAT can also used by programmers that need a way to simply specify that a given
  • key should expire at a given time in the future.
  • <p>
  • Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire
  • set. It is also possible to undo the expire at all turning the key into a normal key using the
  • {@link #persist(String) PERSIST} command.
  • <p>
  • Time complexity: O(1)
  • @see <a href="http://code.google.com/p/redis/wiki/ExpireCommand">ExpireCommand</a>
  • @param key
  • @param unixTime
  • @return Integer reply, specifically: 1: the timeout was set. 0: the timeout was not set since
  • the key already has an associated timeout (this may happen only in Redis versions &lt;
  • 2.1.3, Redis &gt;= 2.1.3 will happily update the timeout), or the key does not exist.

func (*Redis) FlushAll

func (r *Redis) FlushAll() (string, error)

func (*Redis) FlushDB

func (r *Redis) FlushDB() (string, error)

func (*Redis) Geoadd

func (r *Redis) Geoadd(key string, longitude, latitude float64, member string) (int64, error)

func (*Redis) GeoaddByMap

func (r *Redis) GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (int64, error)

func (*Redis) Geodist

func (r *Redis) Geodist(key, member1, member2 string, unit ...GeoUnit) (float64, error)

func (*Redis) Geohash

func (r *Redis) Geohash(key string, members ...string) ([]string, error)

func (*Redis) Geopos

func (r *Redis) Geopos(key string, members ...string) ([]*GeoCoordinate, error)

func (*Redis) Georadius

func (r *Redis) Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, param ...GeoRadiusParam) ([]*GeoCoordinate, error)

func (*Redis) GeoradiusByMember

func (r *Redis) GeoradiusByMember(key, member string, radius float64, unit GeoUnit, param ...GeoRadiusParam) ([]*GeoCoordinate, error)

func (*Redis) Get

func (r *Redis) Get(key string) (string, error)

*

  • Get the value of the specified key. If the key does not exist null is returned. If the value
  • stored at key is not a string an error is returned because GET can only handle string values.
  • <p>
  • Time complexity: O(1)
  • @param key
  • @return Bulk reply

func (*Redis) GetDB

func (r *Redis) GetDB() int

func (*Redis) GetSet

func (r *Redis) GetSet(key, value string) (string, error)

*

  • GETSET is an atomic set this value and return the old value command. Set key to the string
  • value and return the old value stored at key. The string can't be longer than 1073741824 bytes
  • (1 GB).
  • <p>
  • Time complexity: O(1)
  • @param key
  • @param value
  • @return Bulk reply

func (*Redis) Getbit

func (r *Redis) Getbit(key string, offset int64) (bool, error)

func (*Redis) Getrange

func (r *Redis) Getrange(key string, startOffset, endOffset int64) (string, error)

Getrange Warning: this command was renamed to GETRANGE, it is called SUBSTR in Redis versions <= 2.0. Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string. So -1 means the last character, -2 the penultimate and so forth.

The function handles out of range requests by limiting the resulting range to the actual length of the string.

Return value Bulk string reply

func (*Redis) Hdel

func (r *Redis) Hdel(key string, fields ...string) (int64, error)

*

  • Remove the specified field from an hash stored at key.
  • <p>
  • <b>Time complexity:</b> O(1)
  • @param key
  • @param fields
  • @return If the field was present in the hash it is deleted and 1 is returned, otherwise 0 is
  • returned and no operation is performed.

func (*Redis) Hexists

func (r *Redis) Hexists(key, field string) (bool, error)

*

  • Test for existence of a specified field in a hash. <b>Time complexity:</b> O(1)
  • @param key
  • @param field
  • @return Return 1 if the hash stored at key contains the specified field. Return 0 if the key is
  • not found or the field is not present.

func (*Redis) Hget

func (r *Redis) Hget(key, field string) (string, error)

*

  • If key holds a hash, retrieve the value associated to the specified field.
  • <p>
  • If the field is not found or the key does not exist, a special 'nil' value is returned.
  • <p>
  • <b>Time complexity:</b> O(1)
  • @param key
  • @param field
  • @return Bulk reply

func (*Redis) HgetAll

func (r *Redis) HgetAll(key string) (map[string]string, error)

*

  • Return all the fields and associated values in a hash.
  • <p>
  • <b>Time complexity:</b> O(N), where N is the total number of entries
  • @param key
  • @return All the fields and values contained into a hash.

func (*Redis) HincrBy

func (r *Redis) HincrBy(key, field string, value int64) (int64, error)

*

  • Increment the number stored at field in the hash at key by value. If key does not exist, a new
  • key holding a hash is created. If field does not exist or holds a string, the value is set to 0
  • before applying the operation. Since the value argument is signed you can use this command to
  • perform both increments and decrements.
  • <p>
  • The range of values supported by HINCRBY is limited to 64 bit signed integers.
  • <p>
  • <b>Time complexity:</b> O(1)
  • @param key
  • @param field
  • @param value
  • @return Integer reply The new value at field after the increment operation.

func (*Redis) HincrByFloat

func (r *Redis) HincrByFloat(key, field string, value float64) (float64, error)

*

  • Increment the number stored at field in the hash at key by a double precision floating point
  • value. If key does not exist, a new key holding a hash is created. If field does not exist or
  • holds a string, the value is set to 0 before applying the operation. Since the value argument
  • is signed you can use this command to perform both increments and decrements.
  • <p>
  • The range of values supported by HINCRBYFLOAT is limited to double precision floating point
  • values.
  • <p>
  • <b>Time complexity:</b> O(1)
  • @param key
  • @param field
  • @param value
  • @return Double precision floating point reply The new value at field after the increment
  • operation.

func (*Redis) Hkeys

func (r *Redis) Hkeys(key string) ([]string, error)

*

  • Return all the fields in a hash.
  • <p>
  • <b>Time complexity:</b> O(N), where N is the total number of entries
  • @param key
  • @return All the fields names contained into a hash.

func (*Redis) Hlen

func (r *Redis) Hlen(key string) (int64, error)

*

  • Return the number of items in a hash.
  • <p>
  • <b>Time complexity:</b> O(1)
  • @param key
  • @return The number of entries (fields) contained in the hash stored at key. If the specified
  • key does not exist, 0 is returned assuming an empty hash.

func (*Redis) Hmget

func (r *Redis) Hmget(key string, fields ...string) ([]string, error)

*

  • Retrieve the values associated to the specified fields.
  • <p>
  • If some of the specified fields do not exist, nil values are returned. Non existing keys are
  • considered like empty hashes.
  • <p>
  • <b>Time complexity:</b> O(N) (with N being the number of fields)
  • @param key
  • @param fields
  • @return Multi Bulk Reply specifically a list of all the values associated with the specified
  • fields, in the same order of the request.

func (*Redis) Hmset

func (r *Redis) Hmset(key string, hash map[string]string) (string, error)

*

  • Set the respective fields to the respective values. HMSET replaces old values with new values.
  • <p>
  • If key does not exist, a new key holding a hash is created.
  • <p>
  • <b>Time complexity:</b> O(N) (with N being the number of fields)
  • @param key
  • @param hash
  • @return Return OK or Exception if hash is empty

func (*Redis) Hscan

func (r *Redis) Hscan(key, cursor string, params ...ScanParams) (*ScanResult, error)

func (*Redis) Hset

func (r *Redis) Hset(key, field, value string) (int64, error)

*

  • Set the specified hash field to the specified value.
  • <p>
  • If key does not exist, a new key holding a hash is created.
  • <p>
  • <b>Time complexity:</b> O(1)
  • @param key
  • @param field
  • @param value
  • @return If the field already exists, and the HSET just produced an update of the value, 0 is
  • returned, otherwise if a new field is created 1 is returned.

func (*Redis) Hsetnx

func (r *Redis) Hsetnx(key, field, value string) (int64, error)

*

  • Set the specified hash field to the specified value if the field not exists. <b>Time
  • complexity:</b> O(1)
  • @param key
  • @param field
  • @param value
  • @return If the field already exists, 0 is returned, otherwise if a new field is created 1 is
  • returned.

func (*Redis) Hvals

func (r *Redis) Hvals(key string) ([]string, error)

*

  • Return all the values in a hash.
  • <p>
  • <b>Time complexity:</b> O(N), where N is the total number of entries
  • @param key
  • @return All the fields values contained into a hash.

func (*Redis) Incr

func (r *Redis) Incr(key string) (int64, error)

*

  • Increment the number stored at key by one. If the key does not exist or contains a value of a
  • wrong type, set the key to the value of "0" before to perform the increment operation.
  • <p>
  • INCR commands are limited to 64 bit signed integers.
  • <p>
  • Note: this is actually a string operation, that is, in Redis there are not "integer" types.
  • Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented,
  • and then converted back as a string.
  • <p>
  • Time complexity: O(1)
  • @see #incrBy(String, long)
  • @see #decr(String)
  • @see #decrBy(String, long)
  • @param key
  • @return Integer reply, this commands will reply with the new value of key after the increment.

func (*Redis) IncrBy

func (r *Redis) IncrBy(key string, increment int64) (int64, error)

*

  • INCRBY work just like {@link #incr(String) INCR} but instead to increment by 1 the increment is
  • integer.
  • <p>
  • INCR commands are limited to 64 bit signed integers.
  • <p>
  • Note: this is actually a string operation, that is, in Redis there are not "integer" types.
  • Simply the string stored at the key is parsed as a base 10 64 bit signed integer, incremented,
  • and then converted back as a string.
  • <p>
  • Time complexity: O(1)
  • @see #incr(String)
  • @see #decr(String)
  • @see #decrBy(String, long)
  • @param key
  • @param integer
  • @return Integer reply, this commands will reply with the new value of key after the increment.

func (*Redis) IncrByFloat

func (r *Redis) IncrByFloat(key string, increment float64) (float64, error)

*

  • INCRBYFLOAT
  • <p>
  • INCRBYFLOAT commands are limited to double precision floating point values.
  • <p>
  • Note: this is actually a string operation, that is, in Redis there are not "double" types.
  • Simply the string stored at the key is parsed as a base double precision floating point value,
  • incremented, and then converted back as a string. There is no DECRYBYFLOAT but providing a
  • negative value will work as expected.
  • <p>
  • Time complexity: O(1)
  • @param key
  • @param value
  • @return Double reply, this commands will reply with the new value of key after the increment.

func (*Redis) Info

func (r *Redis) Info(section ...string) (string, error)

func (*Redis) Keys

func (r *Redis) Keys(pattern string) ([]string, error)

<editor-fold desc="multikeycommands"> *

  • Returns all the keys matching the glob-style pattern as space separated strings. For example if
  • you have in the database the keys "foo" and "foobar" the command "KEYS foo*" will return
  • "foo foobar".
  • <p>
  • Note that while the time complexity for this operation is O(n) the constant times are pretty
  • low. For example Redis running on an entry level laptop can scan a 1 million keys database in
  • 40 milliseconds. <b>Still it's better to consider this one of the slow commands that may ruin
  • the DB performance if not used with care.</b>
  • <p>
  • In other words this command is intended only for debugging and special operations like creating
  • a script to change the DB schema. Don't use it in your normal code. Use Redis Sets in order to
  • group together a subset of objects.
  • <p>
  • Glob style patterns examples:
  • <ul>
  • <li>h?llo will match hello hallo hhllo
  • <li>h*llo will match hllo heeeello
  • <li>h[ae]llo will match hello and hallo, but not hillo
  • </ul>
  • <p>
  • Use \ to escape special chars if you want to match them verbatim.
  • <p>
  • Time complexity: O(n) (with n being the number of keys in the DB, and assuming keys and pattern
  • of limited length)
  • @param pattern
  • @return Multi bulk reply

func (*Redis) Lastsave

func (r *Redis) Lastsave() (int64, error)

func (*Redis) Lindex

func (r *Redis) Lindex(key string, index int64) (string, error)

*

  • Return the specified element of the list stored at the specified key. 0 is the first element, 1
  • the second and so on. Negative indexes are supported, for example -1 is the last element, -2
  • the penultimate and so on.
  • <p>
  • If the value stored at key is not of list type an error is returned. If the index is out of
  • range a 'nil' reply is returned.
  • <p>
  • Note that even if the average time complexity is O(n) asking for the first or the last element
  • of the list is O(1).
  • <p>
  • Time complexity: O(n) (with n being the length of the list)
  • @param key
  • @param index
  • @return Bulk reply, specifically the requested element

func (*Redis) Linsert

func (r *Redis) Linsert(key string, where ListOption, pivot, value string) (int64, error)

func (*Redis) Llen

func (r *Redis) Llen(key string) (int64, error)

*

  • Return the length of the list stored at the specified key. If the key does not exist zero is
  • returned (the same behaviour as for empty lists). If the value stored at key is not a list an
  • error is returned.
  • <p>
  • Time complexity: O(1)
  • @param key
  • @return The length of the list.

func (*Redis) Lpop

func (r *Redis) Lpop(key string) (string, error)

*

  • Atomically return and remove the first (LPOP) or last (RPOP) element of the list. For example
  • if the list contains the elements "a","b","c" LPOP will return "a" and the list will become
  • "b","c".
  • <p>
  • If the key does not exist or the list is already empty the special value 'nil' is returned.
  • @see #rpop(String)
  • @param key
  • @return Bulk reply

func (*Redis) Lpush

func (r *Redis) Lpush(key string, strings ...string) (int64, error)

*

  • Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key. If the key
  • does not exist an empty list is created just before the append operation. If the key exists but
  • is not a List an error is returned.
  • <p>
  • Time complexity: O(1)
  • @param key
  • @param strings
  • @return Integer reply, specifically, the number of elements inside the list after the push
  • operation.

func (*Redis) Lpushx

func (r *Redis) Lpushx(key string, string ...string) (int64, error)

Lpushx Inserts value at the head of the list stored at key, only if key already exists and holds a list. In contrary to LPUSH, no operation will be performed when key does not yet exist. Return value Integer reply: the length of the list after the push operation.

func (*Redis) Lrange

func (r *Redis) Lrange(key string, start, stop int64) ([]string, error)

*

  • Return the specified elements of the list stored at the specified key. Start and end are
  • zero-based indexes. 0 is the first element of the list (the list head), 1 the next element and
  • so on.
  • <p>
  • For example LRANGE foobar 0 2 will return the first three elements of the list.
  • <p>
  • start and end can also be negative numbers indicating offsets from the end of the list. For
  • example -1 is the last element of the list, -2 the penultimate element and so on.
  • <p>
  • <b>Consistency with range functions in various programming languages</b>
  • <p>
  • Note that if you have a list of numbers from 0 to 100, LRANGE 0 10 will return 11 elements,
  • that is, rightmost item is included. This may or may not be consistent with behavior of
  • range-related functions in your programming language of choice (think Ruby's Range.new,
  • Array#slice or Python's range() function).
  • <p>
  • LRANGE behavior is consistent with one of Tcl.
  • <p>
  • <b>Out-of-range indexes</b>
  • <p>
  • Indexes out of range will not produce an error: if start is over the end of the list, or start
  • &gt; end, an empty list is returned. If end is over the end of the list Redis will threat it
  • just like the last element of the list.
  • <p>
  • Time complexity: O(start+n) (with n being the length of the range and start being the start
  • offset)
  • @param key
  • @param start
  • @param end
  • @return Multi bulk reply, specifically a list of elements in the specified range.

func (*Redis) Lrem

func (r *Redis) Lrem(key string, count int64, value string) (int64, error)

*

  • Remove the first count occurrences of the value element from the list. If count is zero all the
  • elements are removed. If count is negative elements are removed from tail to head, instead to
  • go from head to tail that is the normal behaviour. So for example LREM with count -2 and hello
  • as value to remove against the list (a,b,c,hello,x,hello,hello) will lave the list
  • (a,b,c,hello,x). The number of removed elements is returned as an integer, see below for more
  • information about the returned value. Note that non existing keys are considered like empty
  • lists by LREM, so LREM against non existing keys will always return 0.
  • <p>
  • Time complexity: O(N) (with N being the length of the list)
  • @param key
  • @param count
  • @param value
  • @return Integer Reply, specifically: The number of removed elements if the operation succeeded

func (*Redis) Lset

func (r *Redis) Lset(key string, index int64, value string) (string, error)

*

  • Set a new value as the element at index position of the List at key.
  • <p>
  • Out of range indexes will generate an error.
  • <p>
  • Similarly to other list commands accepting indexes, the index can be negative to access
  • elements starting from the end of the list. So -1 is the last element, -2 is the penultimate,
  • and so forth.
  • <p>
  • <b>Time complexity:</b>
  • <p>
  • O(N) (with N being the length of the list), setting the first or last elements of the list is
  • O(1).
  • @see #lindex(String, long)
  • @param key
  • @param index
  • @param value
  • @return Status code reply

func (*Redis) Ltrim

func (r *Redis) Ltrim(key string, start, stop int64) (string, error)

*

  • Trim an existing list so that it will contain only the specified range of elements specified.
  • Start and end are zero-based indexes. 0 is the first element of the list (the list head), 1 the
  • next element and so on.
  • <p>
  • For example LTRIM foobar 0 2 will modify the list stored at foobar key so that only the first
  • three elements of the list will remain.
  • <p>
  • start and end can also be negative numbers indicating offsets from the end of the list. For
  • example -1 is the last element of the list, -2 the penultimate element and so on.
  • <p>
  • Indexes out of range will not produce an error: if start is over the end of the list, or start
  • &gt; end, an empty list is left as value. If end over the end of the list Redis will threat it
  • just like the last element of the list.
  • <p>
  • Hint: the obvious use of LTRIM is together with LPUSH/RPUSH. For example:
  • <p>
  • {@code lpush("mylist", "someelement"); ltrim("mylist", 0, 99); * }
  • <p>
  • The above two commands will push elements in the list taking care that the list will not grow
  • without limits. This is very useful when using Redis to store logs for example. It is important
  • to note that when used in this way LTRIM is an O(1) operation because in the average case just
  • one element is removed from the tail of the list.
  • <p>
  • Time complexity: O(n) (with n being len of list - len of range)
  • @param key
  • @param start
  • @param end
  • @return Status code reply

func (*Redis) Mget

func (r *Redis) Mget(keys ...string) ([]string, error)

*

  • Get the values of all the specified keys. If one or more keys dont exist or is not of type
  • String, a 'nil' value is returned instead of the value of the specified key, but the operation
  • never fails.
  • <p>
  • Time complexity: O(1) for every key
  • @param keys
  • @return Multi bulk reply

func (*Redis) Move

func (r *Redis) Move(key string, dbIndex int) (int64, error)

func (*Redis) Mset

func (r *Redis) Mset(keysvalues ...string) (string, error)

*

  • Set the the respective keys to the respective values. MSET will replace old values with new
  • values, while {@link #msetnx(String...) MSETNX} will not perform any operation at all even if
  • just a single key already exists.
  • <p>
  • Because of this semantic MSETNX can be used in order to set different keys representing
  • different fields of an unique logic object in a way that ensures that either all the fields or
  • none at all are set.
  • <p>
  • Both MSET and MSETNX are atomic operations. This means that for instance if the keys A and B
  • are modified, another client talking to Redis can either see the changes to both A and B at
  • once, or no modification at all.
  • @see #msetnx(String...)
  • @param keysvalues
  • @return Status code reply Basically +OK as MSET can't fail

func (*Redis) Msetnx

func (r *Redis) Msetnx(keysvalues ...string) (int64, error)

*

  • Set the the respective keys to the respective values. {@link #mset(String...) MSET} will
  • replace old values with new values, while MSETNX will not perform any operation at all even if
  • just a single key already exists.
  • <p>
  • Because of this semantic MSETNX can be used in order to set different keys representing
  • different fields of an unique logic object in a way that ensures that either all the fields or
  • none at all are set.
  • <p>
  • Both MSET and MSETNX are atomic operations. This means that for instance if the keys A and B
  • are modified, another client talking to Redis can either see the changes to both A and B at
  • once, or no modification at all.
  • @see #mset(String...)
  • @param keysvalues
  • @return Integer reply, specifically: 1 if the all the keys were set 0 if no key was set (at
  • least one key already existed)

func (*Redis) Multi

func (r *Redis) Multi() (*Transaction, error)

func (*Redis) ObjectEncoding

func (r *Redis) ObjectEncoding(str string) (string, error)

func (*Redis) ObjectIdletime

func (r *Redis) ObjectIdletime(str string) (int64, error)

func (*Redis) ObjectRefcount

func (r *Redis) ObjectRefcount(str string) (int64, error)

func (*Redis) Persist

func (r *Redis) Persist(key string) (int64, error)

*

  • Undo a {@link #expire(String, int) expire} at turning the expire key into a normal key.
  • <p>
  • Time complexity: O(1)
  • @param key
  • @return Integer reply, specifically: 1: the key is now persist. 0: the key is not persist (only
  • happens when key not set).

func (*Redis) Pexpire

func (r *Redis) Pexpire(key string, milliseconds int64) (int64, error)

func (*Redis) PexpireAt

func (r *Redis) PexpireAt(key string, millisecondsTimestamp int64) (int64, error)

func (*Redis) Pfadd

func (r *Redis) Pfadd(key string, elements ...string) (int64, error)

func (*Redis) Pfcount

func (r *Redis) Pfcount(keys ...string) (int64, error)

func (*Redis) Pfmerge

func (r *Redis) Pfmerge(destkey string, sourcekeys ...string) (string, error)

func (*Redis) Ping

func (r *Redis) Ping() (string, error)

func (*Redis) Pipelined

func (r *Redis) Pipelined() *Pipeline

func (*Redis) Psetex

func (r *Redis) Psetex(key string, milliseconds int64, value string) (string, error)

func (*Redis) Psubscribe

func (r *Redis) Psubscribe(redisPubSub *RedisPubSub, patterns ...string) error

func (*Redis) Pttl

func (r *Redis) Pttl(key string) (int64, error)

Pttl Like TTL this command returns the remaining time to live of a key that has an expire set, with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in milliseconds. In Redis 2.6 or older the command returns -1 if the key does not exist or if the key exist but has no associated expire. Starting with Redis 2.8 the return value in case of error changed: The command returns -2 if the key does not exist. The command returns -1 if the key exists but has no associated expire.

Integer reply: TTL in milliseconds, or a negative value in order to signal an error (see the description above).

func (*Redis) Publish

func (r *Redis) Publish(channel, message string) (int64, error)

func (*Redis) PubsubChannels

func (r *Redis) PubsubChannels(pattern string) ([]string, error)

<editor-fold desc="other commands">

func (*Redis) Quit

func (r *Redis) Quit() (string, error)

<editor-fold desc="basiccommands">

func (*Redis) RandomKey

func (r *Redis) RandomKey() (string, error)

func (*Redis) Readonly

func (r *Redis) Readonly() (string, error)

func (*Redis) Rename

func (r *Redis) Rename(oldkey, newkey string) (string, error)

*

  • Atomically renames the key oldkey to newkey. If the source and destination name are the same an
  • error is returned. If newkey already exists it is overwritten.
  • <p>
  • Time complexity: O(1)
  • @param oldkey
  • @param newkey
  • @return Status code repy

func (*Redis) Renamenx

func (r *Redis) Renamenx(oldkey, newkey string) (int64, error)

*

  • Rename oldkey into newkey but fails if the destination key newkey already exists.
  • <p>
  • Time complexity: O(1)
  • @param oldkey
  • @param newkey
  • @return Integer reply, specifically: 1 if the key was renamed 0 if the target key already exist

func (*Redis) Rpop

func (r *Redis) Rpop(key string) (string, error)

*

  • Atomically return and remove the first (LPOP) or last (RPOP) element of the list. For example
  • if the list contains the elements "a","b","c" RPOP will return "c" and the list will become
  • "a","b".
  • <p>
  • If the key does not exist or the list is already empty the special value 'nil' is returned.
  • @see #lpop(String)
  • @param key
  • @return Bulk reply

func (*Redis) Rpoplpush

func (r *Redis) Rpoplpush(srckey, dstkey string) (string, error)

*

  • Atomically return and remove the last (tail) element of the srckey list, and push the element
  • as the first (head) element of the dstkey list. For example if the source list contains the
  • elements "a","b","c" and the destination list contains the elements "foo","bar" after an
  • RPOPLPUSH command the content of the two lists will be "a","b" and "c","foo","bar".
  • <p>
  • If the key does not exist or the list is already empty the special value 'nil' is returned. If
  • the srckey and dstkey are the same the operation is equivalent to removing the last element
  • from the list and pusing it as first element of the list, so it's a "list rotation" command.
  • <p>
  • Time complexity: O(1)
  • @param srckey
  • @param dstkey
  • @return Bulk reply

func (*Redis) Rpush

func (r *Redis) Rpush(key string, strings ...string) (int64, error)

*

  • Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key. If the key
  • does not exist an empty list is created just before the append operation. If the key exists but
  • is not a List an error is returned.
  • <p>
  • Time complexity: O(1)
  • @param key
  • @param strings
  • @return Integer reply, specifically, the number of elements inside the list after the push
  • operation.

func (*Redis) Rpushx

func (r *Redis) Rpushx(key string, string ...string) (int64, error)

Rpushx Inserts value at the tail of the list stored at key, only if key already exists and holds a list. In contrary to RPUSH, no operation will be performed when key does not yet exist.

Return value Integer reply: the length of the list after the push operation.

func (*Redis) Sadd

func (r *Redis) Sadd(key string, members ...string) (int64, error)

*

  • Add the specified member to the set value stored at key. If member is already a member of the
  • set no operation is performed. If key does not exist a new set with the specified member as
  • sole member is created. If the key exists but does not hold a set value an error is returned.
  • <p>
  • Time complexity O(1)
  • @param key
  • @param members
  • @return Integer reply, specifically: 1 if the new element was added 0 if the element was
  • already a member of the set

func (*Redis) Save

func (r *Redis) Save() (string, error)

func (*Redis) Scan

func (r *Redis) Scan(cursor string, params ...ScanParams) (*ScanResult, error)

func (*Redis) Scard

func (r *Redis) Scard(key string) (int64, error)

*

  • Return the set cardinality (number of elements). If the key does not exist 0 is returned, like
  • for empty sets.
  • @param key
  • @return Integer reply, specifically: the cardinality (number of elements) of the set as an
  • integer.

func (*Redis) ScriptExists

func (r *Redis) ScriptExists(sha1 ...string) ([]bool, error)

func (*Redis) ScriptLoad

func (r *Redis) ScriptLoad(script string) (string, error)

func (*Redis) Sdiff

func (r *Redis) Sdiff(keys ...string) ([]string, error)

*

  • Return the difference between the Set stored at key1 and all the Sets key2, ..., keyN
  • <p>
  • <b>Example:</b> *
  • <pre>
  • key1 = [x, a, b, c]
  • key2 = [c]
  • key3 = [a, d]
  • SDIFF key1,key2,key3 =&gt; [x, b]
  • </pre> *
  • Non existing keys are considered like empty sets.
  • <p>
  • <b>Time complexity:</b>
  • <p>
  • O(N) with N being the total number of elements of all the sets
  • @param keys
  • @return Return the members of a set resulting from the difference between the first set
  • provided and all the successive sets.

func (*Redis) Sdiffstore

func (r *Redis) Sdiffstore(dstkey string, keys ...string) (int64, error)

*

  • This command works exactly like {@link #sdiff(String...) SDIFF} but instead of being returned
  • the resulting set is stored in dstkey.
  • @param dstkey
  • @param keys
  • @return Status code reply

func (*Redis) Select

func (r *Redis) Select(index int) (string, error)

func (*Redis) SentinelFailover

func (r *Redis) SentinelFailover(masterName string) (string, error)

func (*Redis) SentinelGetMasterAddrByName

func (r *Redis) SentinelGetMasterAddrByName(masterName string) ([]string, error)

*

  • <pre>
  • redis 127.0.0.1:26381&gt; sentinel get-master-addr-by-name mymaster
  • 1) "127.0.0.1"
  • 2) "6379"
  • </pre>
  • @param masterName
  • @return two elements list of strings : host and port.

func (*Redis) SentinelMasters

func (r *Redis) SentinelMasters() ([]map[string]string, error)

<editor-fold desc="sentinelcommands"> *

  • <pre>
  • redis 127.0.0.1:26381&gt; sentinel masters
  • 1) 1) "name"
  • 2) "mymaster"
  • 3) "ip"
  • 4) "127.0.0.1"
  • 5) "port"
  • 6) "6379"
  • 7) "runid"
  • 8) "93d4d4e6e9c06d0eea36e27f31924ac26576081d"
  • 9) "flags"
  • 10) "master"
  • 11) "pending-commands"
  • 12) "0"
  • 13) "last-ok-ping-reply"
  • 14) "423"
  • 15) "last-ping-reply"
  • 16) "423"
  • 17) "info-refresh"
  • 18) "6107"
  • 19) "num-slaves"
  • 20) "1"
  • 21) "num-other-sentinels"
  • 22) "2"
  • 23) "quorum"
  • 24) "2" *
  • </pre>
  • @return

func (*Redis) SentinelMonitor

func (r *Redis) SentinelMonitor(masterName, ip string, port, quorum int) (string, error)

func (*Redis) SentinelRemove

func (r *Redis) SentinelRemove(masterName string) (string, error)

func (*Redis) SentinelReset

func (r *Redis) SentinelReset(pattern string) (int64, error)

*

  • <pre>
  • redis 127.0.0.1:26381&gt; sentinel reset mymaster
  • (integer) 1
  • </pre>
  • @param pattern
  • @return

func (*Redis) SentinelSet

func (r *Redis) SentinelSet(masterName string, parameterMap map[string]string) (string, error)

func (*Redis) SentinelSlaves

func (r *Redis) SentinelSlaves(masterName string) ([]map[string]string, error)

*

  • <pre>
  • redis 127.0.0.1:26381&gt; sentinel slaves mymaster
  • 1) 1) "name"
  • 2) "127.0.0.1:6380"
  • 3) "ip"
  • 4) "127.0.0.1"
  • 5) "port"
  • 6) "6380"
  • 7) "runid"
  • 8) "d7f6c0ca7572df9d2f33713df0dbf8c72da7c039"
  • 9) "flags"
  • 10) "slave"
  • 11) "pending-commands"
  • 12) "0"
  • 13) "last-ok-ping-reply"
  • 14) "47"
  • 15) "last-ping-reply"
  • 16) "47"
  • 17) "info-refresh"
  • 18) "657"
  • 19) "master-link-down-time"
  • 20) "0"
  • 21) "master-link-status"
  • 22) "ok"
  • 23) "master-host"
  • 24) "localhost"
  • 25) "master-port"
  • 26) "6379"
  • 27) "slave-priority"
  • 28) "100"
  • </pre>
  • @param masterName
  • @return

func (*Redis) Set

func (r *Redis) Set(key, value string) (string, error)

<editor-fold desc="rediscommands"> *

  • Set the string value as value of the key. The string can't be longer than 1073741824 bytes (1
  • GB).
  • <p>
  • Time complexity: O(1)
  • @param key
  • @param value
  • @return Status code reply

func (*Redis) SetWithParams

func (r *Redis) SetWithParams(key, value, nxxx string) (string, error)

func (*Redis) SetWithParamsAndTime

func (r *Redis) SetWithParamsAndTime(key, value, nxxx, expx string, time int64) (string, error)

*

  • Set the string value as value of the key. The string can't be longer than 1073741824 bytes (1
  • GB).
  • @param key
  • @param value
  • @param nxxx NX|XX, NX -- Only set the key if it does not already exist. XX -- Only set the key
  • if it already exist.
  • @param expx EX|PX, expire time units: EX = seconds; PX = milliseconds
  • @param time expire time in the units of <code>expx</code>
  • @return Status code reply

func (*Redis) Setbit

func (r *Redis) Setbit(key string, offset int64, value string) (bool, error)

func (*Redis) SetbitWithBool

func (r *Redis) SetbitWithBool(key string, offset int64, value bool) (bool, error)

func (*Redis) Setex

func (r *Redis) Setex(key string, seconds int, value string) (string, error)

*

  • The command is exactly equivalent to the following group of commands:
  • {@link #set(String, String) SET} + {@link #expire(String, int) EXPIRE}. The operation is
  • atomic.
  • <p>
  • Time complexity: O(1)
  • @param key
  • @param seconds
  • @param value
  • @return Status code reply

func (*Redis) Setnx

func (r *Redis) Setnx(key, value string) (int64, error)

*

  • SETNX works exactly like {@link #set(String, String) SET} with the only difference that if the
  • key already exists no operation is performed. SETNX actually means "SET if Not eXists".
  • <p>
  • Time complexity: O(1)
  • @param key
  • @param value
  • @return Integer reply, specifically: 1 if the key was set 0 if the key was not set

func (*Redis) Setrange

func (r *Redis) Setrange(key string, offset int64, value string) (int64, error)

Setrange Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value. If the offset is larger than the current length of the string at key, the string is padded with zero-bytes to make offset fit. Non-existing keys are considered as empty strings, so this command will make sure it holds a string large enough to be able to set value at offset. Note that the maximum offset that you can set is 229 -1 (536870911), as Redis Strings are limited to 512 megabytes. If you need to grow beyond this size, you can use multiple keys.

Warning: When setting the last possible byte and the string value stored at key does not yet hold a string value, or holds a small string value, Redis needs to allocate all intermediate memory which can block the server for some time. On a 2010 MacBook Pro, setting byte number 536870911 (512MB allocation) takes ~300ms, setting byte number 134217728 (128MB allocation) takes ~80ms, setting bit number 33554432 (32MB allocation) takes ~30ms and setting bit number 8388608 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETRANGE for the same key will not have the allocation overhead.

Patterns Thanks to SETRANGE and the analogous GETRANGE commands, you can use Redis strings as a linear array with O(1) random access. This is a very fast and efficient storage in many real world use cases.

Return value Integer reply: the length of the string after it was modified by the command.

func (*Redis) Shutdown

func (r *Redis) Shutdown() (string, error)

func (*Redis) Sinter

func (r *Redis) Sinter(keys ...string) ([]string, error)

*

  • Return the members of a set resulting from the intersection of all the sets hold at the
  • specified keys. Like in {@link #lrange(String, long, long) LRANGE} the result is sent to the
  • client as a multi-bulk reply (see the protocol specification for more information). If just a
  • single key is specified, then this command produces the same result as
  • {@link #smembers(String) SMEMBERS}. Actually SMEMBERS is just syntax sugar for SINTER.
  • <p>
  • Non existing keys are considered like empty sets, so if one of the keys is missing an empty set
  • is returned (since the intersection with an empty set always is an empty set).
  • <p>
  • Time complexity O(N*M) worst case where N is the cardinality of the smallest set and M the
  • number of sets
  • @param keys
  • @return Multi bulk reply, specifically the list of common elements.

func (*Redis) Sinterstore

func (r *Redis) Sinterstore(dstkey string, keys ...string) (int64, error)

*

  • This commnad works exactly like {@link #sinter(String...) SINTER} but instead of being returned
  • the resulting set is sotred as dstkey.
  • <p>
  • Time complexity O(N*M) worst case where N is the cardinality of the smallest set and M the
  • number of sets
  • @param dstkey
  • @param keys
  • @return Status code reply

func (*Redis) Sismember

func (r *Redis) Sismember(key, member string) (bool, error)

*

  • Return 1 if member is a member of the set stored at key, otherwise 0 is returned.
  • <p>
  • Time complexity O(1)
  • @param key
  • @param member
  • @return Integer reply, specifically: 1 if the element is a member of the set 0 if the element
  • is not a member of the set OR if the key does not exist

func (*Redis) Slaveof

func (r *Redis) Slaveof(host string, port int) (string, error)

func (*Redis) SlaveofNoOne

func (r *Redis) SlaveofNoOne() (string, error)

func (*Redis) SlowlogGet

func (r *Redis) SlowlogGet(entries ...int64) ([]Slowlog, error)

func (*Redis) SlowlogLen

func (r *Redis) SlowlogLen() (int64, error)

func (*Redis) SlowlogReset

func (r *Redis) SlowlogReset() (string, error)

func (*Redis) Smembers

func (r *Redis) Smembers(key string) ([]string, error)

*

  • Return all the members (elements) of the set value stored at key. This is just syntax glue for
  • {@link #sinter(String...) SINTER}.
  • <p>
  • Time complexity O(N)
  • @param key
  • @return Multi bulk reply

func (*Redis) Smove

func (r *Redis) Smove(srckey, dstkey, member string) (int64, error)

*

  • Move the specifided member from the set at srckey to the set at dstkey. This operation is
  • atomic, in every given moment the element will appear to be in the source or destination set
  • for accessing clients.
  • <p>
  • If the source set does not exist or does not contain the specified element no operation is
  • performed and zero is returned, otherwise the element is removed from the source set and added
  • to the destination set. On success one is returned, even if the element was already present in
  • the destination set.
  • <p>
  • An error is raised if the source or destination keys contain a non Set value.
  • <p>
  • Time complexity O(1)
  • @param srckey
  • @param dstkey
  • @param member
  • @return Integer reply, specifically: 1 if the element was moved 0 if the element was not found
  • on the first set and no operation was performed

func (*Redis) Sort

func (r *Redis) Sort(key string, sortingParameters ...SortingParams) ([]string, error)

*

  • Sort a Set or a List.
  • <p>
  • Sort the elements contained in the List, Set, or Sorted Set value at key. By default sorting is
  • numeric with elements being compared as double precision floating point numbers. This is the
  • simplest form of SORT.
  • @see #sort(String, String)
  • @see #sort(String, SortingParams)
  • @see #sort(String, SortingParams, String)
  • @param key
  • @return Assuming the Set/List at key contains a list of numbers, the return value will be the
  • list of numbers ordered from the smallest to the biggest number.

func (*Redis) SortMulti

func (r *Redis) SortMulti(key, dstkey string, sortingParameters ...SortingParams) (int64, error)

func (*Redis) Spop

func (r *Redis) Spop(key string) (string, error)

*

  • Remove a random element from a Set returning it as return value. If the Set is empty or the key
  • does not exist, a nil object is returned.
  • <p>
  • The {@link #srandmember(String)} command does a similar work but the returned element is not
  • removed from the Set.
  • <p>
  • Time complexity O(1)
  • @param key
  • @return Bulk reply

func (*Redis) SpopBatch

func (r *Redis) SpopBatch(key string, count int64) ([]string, error)

func (*Redis) Srandmember

func (r *Redis) Srandmember(key string) (string, error)

*

  • Return a random element from a Set, without removing the element. If the Set is empty or the
  • key does not exist, a nil object is returned.
  • <p>
  • The SPOP command does a similar work but the returned element is popped (removed) from the Set.
  • <p>
  • Time complexity O(1)
  • @param key
  • @return Bulk reply

func (*Redis) SrandmemberBatch

func (r *Redis) SrandmemberBatch(key string, count int) ([]string, error)

func (*Redis) Srem

func (r *Redis) Srem(key string, members ...string) (int64, error)

*

  • Remove the specified member from the set value stored at key. If member was not a member of the
  • set no operation is performed. If key does not hold a set value an error is returned.
  • <p>
  • Time complexity O(1)
  • @param key
  • @param members
  • @return Integer reply, specifically: 1 if the new element was removed 0 if the new element was
  • not a member of the set

func (*Redis) Sscan

func (r *Redis) Sscan(key, cursor string, params ...ScanParams) (*ScanResult, error)

func (*Redis) Strlen

func (r *Redis) Strlen(key string) (int64, error)

Strlen Returns the length of the string value stored at key. An error is returned when key holds a non-string value. Return value Integer reply: the length of the string at key, or 0 when key does not exist.

func (*Redis) Subscribe

func (r *Redis) Subscribe(redisPubSub *RedisPubSub, channels ...string) error

func (*Redis) Substr

func (r *Redis) Substr(key string, start, end int) (string, error)

*

  • Return a subset of the string from offset start to offset end (both offsets are inclusive).
  • Negative offsets can be used in order to provide an offset starting from the end of the string.
  • So -1 means the last char, -2 the penultimate and so forth.
  • <p>
  • The function handles out of range requests without raising an error, but just limiting the
  • resulting range to the actual length of the string.
  • <p>
  • Time complexity: O(start+n) (with start being the start index and n the total length of the
  • requested range). Note that the lookup part of this command is O(1) so for small strings this
  • is actually an O(1) command.
  • @param key
  • @param start
  • @param end
  • @return Bulk reply

func (*Redis) Sunion

func (r *Redis) Sunion(keys ...string) ([]string, error)

*

  • Return the members of a set resulting from the union of all the sets hold at the specified
  • keys. Like in {@link #lrange(String, long, long) LRANGE} the result is sent to the client as a
  • multi-bulk reply (see the protocol specification for more information). If just a single key is
  • specified, then this command produces the same result as {@link #smembers(String) SMEMBERS}.
  • <p>
  • Non existing keys are considered like empty sets.
  • <p>
  • Time complexity O(N) where N is the total number of elements in all the provided sets
  • @param keys
  • @return Multi bulk reply, specifically the list of common elements.

func (*Redis) Sunionstore

func (r *Redis) Sunionstore(dstkey string, keys ...string) (int64, error)

*

  • This command works exactly like {@link #sunion(String...) SUNION} but instead of being returned
  • the resulting set is stored as dstkey. Any existing value in dstkey will be over-written.
  • <p>
  • Time complexity O(N) where N is the total number of elements in all the provided sets
  • @param dstkey
  • @param keys
  • @return Status code reply

func (*Redis) Ttl

func (r *Redis) Ttl(key string) (int64, error)

*

  • The TTL command returns the remaining time to live in seconds of a key that has an
  • {@link #expire(String, int) EXPIRE} set. This introspection capability allows a Redis client to
  • check how many seconds a given key will continue to be part of the dataset.
  • @param key
  • @return Integer reply, returns the remaining time to live in seconds of a key that has an
  • EXPIRE. In Redis 2.6 or older, if the Key does not exists or does not have an
  • associated expire, -1 is returned. In Redis 2.8 or newer, if the Key does not have an
  • associated expire, -1 is returned or if the Key does not exists, -2 is returned.

func (*Redis) Type

func (r *Redis) Type(key string) (string, error)

*

  • Return the type of the value stored at key in form of a string. The type can be one of "none",
  • "string", "list", "set". "none" is returned if the key does not exist. Time complexity: O(1)
  • @param key
  • @return Status code reply, specifically: "none" if the key does not exist "string" if the key
  • contains a String value "list" if the key contains a List value "set" if the key
  • contains a Set value "zset" if the key contains a Sorted Set value "hash" if the key
  • contains a Hash value

func (*Redis) Unwatch

func (r *Redis) Unwatch() (string, error)

func (*Redis) WaitReplicas

func (r *Redis) WaitReplicas(replicas int, timeout int64) (int64, error)

func (*Redis) Watch

func (r *Redis) Watch(keys ...string) (string, error)

func (*Redis) Zadd

func (r *Redis) Zadd(key string, score float64, member string, mparams ...ZAddParams) (int64, error)

*

  • Add the specified member having the specifeid score to the sorted set stored at key. If member
  • is already a member of the sorted set the score is updated, and the element reinserted in the
  • right position to ensure sorting. If key does not exist a new sorted set with the specified
  • member as sole member is crated. If the key exists but does not hold a sorted set value an
  • error is returned.
  • <p>
  • The score value can be the string representation of a double precision floating point number.
  • <p>
  • Time complexity O(log(N)) with N being the number of elements in the sorted set
  • @param key
  • @param score
  • @param member
  • @return Integer reply, specifically: 1 if the new element was added 0 if the element was
  • already a member of the sorted set and the score was updated

func (*Redis) ZaddByMap

func (r *Redis) ZaddByMap(key string, scoreMembers map[string]float64, params ...ZAddParams) (int64, error)

func (*Redis) Zcard

func (r *Redis) Zcard(key string) (int64, error)

*

  • Return the sorted set cardinality (number of elements). If the key does not exist 0 is
  • returned, like for empty sorted sets.
  • <p>
  • Time complexity O(1)
  • @param key
  • @return the cardinality (number of elements) of the set as an integer.

func (*Redis) Zcount

func (r *Redis) Zcount(key, min, max string) (int64, error)

Zcount Returns the number of elements in the sorted set at key with a score between min and max. The min and max arguments have the same semantic as described for ZRANGEBYSCORE. Note: the command has a complexity of just O(log(N)) because it uses elements ranks (see ZRANK) to get an idea of the range. Because of this there is no need to do a work proportional to the size of the range.

Return value Integer reply: the number of elements in the specified score range.

func (*Redis) Zincrby

func (r *Redis) Zincrby(key string, increment float64, member string, params ...ZAddParams) (float64, error)

*

  • If member already exists in the sorted set adds the increment to its score and updates the
  • position of the element in the sorted set accordingly. If member does not already exist in the
  • sorted set it is added with increment as score (that is, like if the previous score was
  • virtually zero). If key does not exist a new sorted set with the specified member as sole
  • member is crated. If the key exists but does not hold a sorted set value an error is returned.
  • <p>
  • The score value can be the string representation of a double precision floating point number.
  • It's possible to provide a negative value to perform a decrement.
  • <p>
  • For an introduction to sorted sets check the Introduction to Redis data types page.
  • <p>
  • Time complexity O(log(N)) with N being the number of elements in the sorted set
  • @param key
  • @param score
  • @param member
  • @return The new score

func (*Redis) Zinterstore

func (r *Redis) Zinterstore(dstkey string, sets ...string) (int64, error)

*

  • Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
  • dstkey. It is mandatory to provide the number of input keys N, before passing the input keys
  • and the other (optional) arguments.
  • <p>
  • As the terms imply, the {@link #zinterstore(String, String...) ZINTERSTORE} command requires an
  • element to be present in each of the given inputs to be inserted in the result. The
  • {@link #zunionstore(String, String...) ZUNIONSTORE} command inserts all elements across all
  • inputs.
  • <p>
  • Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means
  • that the score of each element in the sorted set is first multiplied by this weight before
  • being passed to the aggregation. When this option is not given, all weights default to 1.
  • <p>
  • With the AGGREGATE option, it's possible to specify how the results of the union or
  • intersection are aggregated. This option defaults to SUM, where the score of an element is
  • summed across the inputs where it exists. When this option is set to be either MIN or MAX, the
  • resulting set will contain the minimum or maximum score of an element across the inputs where
  • it exists.
  • <p>
  • <b>Time complexity:</b> O(N) + O(M log(M)) with N being the sum of the sizes of the input
  • sorted sets, and M being the number of elements in the resulting sorted set
  • @see #zunionstore(String, String...)
  • @see #zunionstore(String, ZParams, String...)
  • @see #zinterstore(String, String...)
  • @see #zinterstore(String, ZParams, String...)
  • @param dstkey
  • @param sets
  • @return Integer reply, specifically the number of elements in the sorted set at dstkey

func (*Redis) ZinterstoreWithParams

func (r *Redis) ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)

func (*Redis) Zlexcount

func (r *Redis) Zlexcount(key, min, max string) (int64, error)

func (*Redis) Zrange

func (r *Redis) Zrange(key string, start, stop int64) ([]string, error)

func (*Redis) ZrangeByLex

func (r *Redis) ZrangeByLex(key, min, max string) ([]string, error)

func (*Redis) ZrangeByLexBatch

func (r *Redis) ZrangeByLexBatch(key, min, max string, offset, count int) ([]string, error)

func (*Redis) ZrangeByScore

func (r *Redis) ZrangeByScore(key, min, max string) ([]string, error)

*

  • Return the all the elements in the sorted set at key with a score between min and max
  • (including elements with score equal to min or max).
  • <p>
  • The elements having the same score are returned sorted lexicographically as ASCII strings (this
  • follows from a property of Redis sorted sets and does not involve further computation).
  • <p>
  • Using the optional {@link #zrangeByScore(String, double, double, int, int) LIMIT} it's possible
  • to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
  • the commands needs to traverse the list for offset elements and this adds up to the O(M)
  • figure.
  • <p>
  • The {@link #zcount(String, double, double) ZCOUNT} command is similar to
  • {@link #zrangeByScore(String, double, double) ZRANGEBYSCORE} but instead of returning the
  • actual elements in the specified interval, it just returns the number of matching elements.
  • <p>
  • <b>Exclusive intervals and infinity</b>
  • <p>
  • min and max can be -inf and +inf, so that you are not required to know what's the greatest or
  • smallest element in order to take, for instance, elements "up to a given value".
  • <p>
  • Also while the interval is for default closed (inclusive) it's possible to specify open
  • intervals prefixing the score with a "(" character, so for instance:
  • <p>
  • {@code ZRANGEBYSCORE zset (1.3 5}
  • <p>
  • Will return all the values with score &gt; 1.3 and &lt;= 5, while for instance:
  • <p>
  • {@code ZRANGEBYSCORE zset (5 (10}
  • <p>
  • Will return all the values with score &gt; 5 and &lt; 10 (5 and 10 excluded).
  • <p>
  • <b>Time complexity:</b>
  • <p>
  • O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of
  • elements returned by the command, so if M is constant (for instance you always ask for the
  • first ten elements with LIMIT) you can consider it O(log(N))
  • @see #zrangeByScore(String, double, double)
  • @see #zrangeByScore(String, double, double, int, int)
  • @see #zrangeByScoreWithScores(String, double, double)
  • @see #zrangeByScoreWithScores(String, String, String)
  • @see #zrangeByScoreWithScores(String, double, double, int, int)
  • @see #zcount(String, double, double)
  • @param key
  • @param min a double or Double.MIN_VALUE for "-inf"
  • @param max a double or Double.MAX_VALUE for "+inf"
  • @return Multi bulk reply specifically a list of elements in the specified score range.

func (*Redis) ZrangeByScoreBatch

func (r *Redis) ZrangeByScoreBatch(key, min, max string, offset, count int) ([]string, error)

func (*Redis) ZrangeByScoreWithScores

func (r *Redis) ZrangeByScoreWithScores(key, min, max string) ([]Tuple, error)

*

  • Return the all the elements in the sorted set at key with a score between min and max
  • (including elements with score equal to min or max).
  • <p>
  • The elements having the same score are returned sorted lexicographically as ASCII strings (this
  • follows from a property of Redis sorted sets and does not involve further computation).
  • <p>
  • Using the optional {@link #zrangeByScore(String, double, double, int, int) LIMIT} it's possible
  • to get only a range of the matching elements in an SQL-alike way. Note that if offset is large
  • the commands needs to traverse the list for offset elements and this adds up to the O(M)
  • figure.
  • <p>
  • The {@link #zcount(String, double, double) ZCOUNT} command is similar to
  • {@link #zrangeByScore(String, double, double) ZRANGEBYSCORE} but instead of returning the
  • actual elements in the specified interval, it just returns the number of matching elements.
  • <p>
  • <b>Exclusive intervals and infinity</b>
  • <p>
  • min and max can be -inf and +inf, so that you are not required to know what's the greatest or
  • smallest element in order to take, for instance, elements "up to a given value".
  • <p>
  • Also while the interval is for default closed (inclusive) it's possible to specify open
  • intervals prefixing the score with a "(" character, so for instance:
  • <p>
  • {@code ZRANGEBYSCORE zset (1.3 5}
  • <p>
  • Will return all the values with score &gt; 1.3 and &lt;= 5, while for instance:
  • <p>
  • {@code ZRANGEBYSCORE zset (5 (10}
  • <p>
  • Will return all the values with score &gt; 5 and &lt; 10 (5 and 10 excluded).
  • <p>
  • <b>Time complexity:</b>
  • <p>
  • O(log(N))+O(M) with N being the number of elements in the sorted set and M the number of
  • elements returned by the command, so if M is constant (for instance you always ask for the
  • first ten elements with LIMIT) you can consider it O(log(N))
  • @see #zrangeByScore(String, double, double)
  • @see #zrangeByScore(String, double, double, int, int)
  • @see #zrangeByScoreWithScores(String, double, double)
  • @see #zrangeByScoreWithScores(String, double, double, int, int)
  • @see #zcount(String, double, double)
  • @param key
  • @param min
  • @param max
  • @return Multi bulk reply specifically a list of elements in the specified score range.

func (*Redis) ZrangeByScoreWithScoresBatch

func (r *Redis) ZrangeByScoreWithScoresBatch(key, min, max string, offset, count int) ([]Tuple, error)

func (*Redis) ZrangeWithScores

func (r *Redis) ZrangeWithScores(key string, start, end int64) ([]Tuple, error)

func (*Redis) Zrank

func (r *Redis) Zrank(key, member string) (int64, error)

*

  • Return the rank (or index) or member in the sorted set at key, with scores being ordered from
  • low to high.
  • <p>
  • When the given member does not exist in the sorted set, the special value 'nil' is returned.
  • The returned rank (or index) of the member is 0-based for both commands.
  • <p>
  • <b>Time complexity:</b>
  • <p>
  • O(log(N))
  • @see #zrevrank(String, String)
  • @param key
  • @param member
  • @return Integer reply or a nil bulk reply, specifically: the rank of the element as an integer
  • reply if the element exists. A nil bulk reply if there is no such element.

func (*Redis) Zrem

func (r *Redis) Zrem(key string, members ...string) (int64, error)

*

  • Remove the specified member from the sorted set value stored at key. If member was not a member
  • of the set no operation is performed. If key does not not hold a set value an error is
  • returned.
  • <p>
  • Time complexity O(log(N)) with N being the number of elements in the sorted set
  • @param key
  • @param members
  • @return Integer reply, specifically: 1 if the new element was removed 0 if the new element was
  • not a member of the set

func (*Redis) ZremrangeByLex

func (r *Redis) ZremrangeByLex(key, min, max string) (int64, error)

func (*Redis) ZremrangeByRank

func (r *Redis) ZremrangeByRank(key string, start, stop int64) (int64, error)

*

  • Remove all elements in the sorted set at key with rank between start and end. Start and end are
  • 0-based with rank 0 being the element with the lowest score. Both start and end can be negative
  • numbers, where they indicate offsets starting at the element with the highest rank. For
  • example: -1 is the element with the highest score, -2 the element with the second highest score
  • and so forth.
  • <p>
  • <b>Time complexity:</b> O(log(N))+O(M) with N being the number of elements in the sorted set
  • and M the number of elements removed by the operation

func (*Redis) ZremrangeByScore

func (r *Redis) ZremrangeByScore(key, start, end string) (int64, error)

func (*Redis) Zrevrange

func (r *Redis) Zrevrange(key string, start, stop int64) ([]string, error)

func (*Redis) ZrevrangeByLex

func (r *Redis) ZrevrangeByLex(key, max, min string) ([]string, error)

func (*Redis) ZrevrangeByLexBatch

func (r *Redis) ZrevrangeByLexBatch(key, max, min string, offset, count int) ([]string, error)

func (*Redis) ZrevrangeByScore

func (r *Redis) ZrevrangeByScore(key, max, min string) ([]string, error)

ZrevrangeByScore Returns all the elements in the sorted set at key with a score between max and min (including elements with score equal to max or min). In contrary to the default ordering of sorted sets, for this command the elements are considered to be ordered from high to low scores. The elements having the same score are returned in reverse lexicographical order. Apart from the reversed ordering, ZREVRANGEBYSCORE is similar to ZRANGEBYSCORE.

Return value Array reply: list of elements in the specified score range (optionally with their scores).

func (*Redis) ZrevrangeByScoreWithScores

func (r *Redis) ZrevrangeByScoreWithScores(key, max, min string) ([]Tuple, error)

func (*Redis) ZrevrangeByScoreWithScoresBatch

func (r *Redis) ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) ([]Tuple, error)

func (*Redis) ZrevrangeWithScores

func (r *Redis) ZrevrangeWithScores(key string, start, end int64) ([]Tuple, error)

func (*Redis) Zrevrank

func (r *Redis) Zrevrank(key, member string) (int64, error)

*

  • Return the rank (or index) or member in the sorted set at key, with scores being ordered from
  • high to low.
  • <p>
  • When the given member does not exist in the sorted set, the special value 'nil' is returned.
  • The returned rank (or index) of the member is 0-based for both commands.
  • <p>
  • <b>Time complexity:</b>
  • <p>
  • O(log(N))
  • @see #zrank(String, String)
  • @param key
  • @param member
  • @return Integer reply or a nil bulk reply, specifically: the rank of the element as an integer
  • reply if the element exists. A nil bulk reply if there is no such element.

func (*Redis) Zscan

func (r *Redis) Zscan(key, cursor string, params ...ScanParams) (*ScanResult, error)

func (*Redis) Zscore

func (r *Redis) Zscore(key, member string) (float64, error)

*

  • Return the score of the specified element of the sorted set at key. If the specified element
  • does not exist in the sorted set, or the key does not exist at all, a special 'nil' value is
  • returned.
  • <p>
  • <b>Time complexity:</b> O(1)
  • @param key
  • @param member
  • @return the score

func (*Redis) Zunionstore

func (r *Redis) Zunionstore(dstkey string, sets ...string) (int64, error)

*

  • Creates a union or intersection of N sorted sets given by keys k1 through kN, and stores it at
  • dstkey. It is mandatory to provide the number of input keys N, before passing the input keys
  • and the other (optional) arguments.
  • <p>
  • As the terms imply, the {@link #zinterstore(String, String...) ZINTERSTORE} command requires an
  • element to be present in each of the given inputs to be inserted in the result. The
  • {@link #zunionstore(String, String...) ZUNIONSTORE} command inserts all elements across all
  • inputs.
  • <p>
  • Using the WEIGHTS option, it is possible to add weight to each input sorted set. This means
  • that the score of each element in the sorted set is first multiplied by this weight before
  • being passed to the aggregation. When this option is not given, all weights default to 1.
  • <p>
  • With the AGGREGATE option, it's possible to specify how the results of the union or
  • intersection are aggregated. This option defaults to SUM, where the score of an element is
  • summed across the inputs where it exists. When this option is set to be either MIN or MAX, the
  • resulting set will contain the minimum or maximum score of an element across the inputs where
  • it exists.
  • <p>
  • <b>Time complexity:</b> O(N) + O(M log(M)) with N being the sum of the sizes of the input
  • sorted sets, and M being the number of elements in the resulting sorted set
  • @see #zunionstore(String, String...)
  • @see #zunionstore(String, ZParams, String...)
  • @see #zinterstore(String, String...)
  • @see #zinterstore(String, ZParams, String...)
  • @param dstkey
  • @param sets
  • @return Integer reply, specifically the number of elements in the sorted set at dstkey

func (*Redis) ZunionstoreWithParams

func (r *Redis) ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)

type RedisCluster

type RedisCluster struct {
	MaxAttempts       int
	ConnectionHandler *RedisClusterConnectionHandler
}

func NewRedisCluster

func NewRedisCluster(nodes []string, connectionTimeout, soTimeout, maxAttempts int, password string, poolConfig PoolConfig) *RedisCluster

func (*RedisCluster) Append

func (r *RedisCluster) Append(key, value string) (int64, error)

func (*RedisCluster) Bitcount

func (r *RedisCluster) Bitcount(key string) (int64, error)

func (*RedisCluster) BitcountRange

func (r *RedisCluster) BitcountRange(key string, start int64, end int64) (int64, error)

func (*RedisCluster) Bitfield

func (r *RedisCluster) Bitfield(key string, arguments ...string) ([]int64, error)

func (*RedisCluster) Bitop

func (r *RedisCluster) Bitop(op BitOP, destKey string, srcKeys ...string) (int64, error)

func (*RedisCluster) Bitpos

func (r *RedisCluster) Bitpos(key string, value bool, params ...BitPosParams) (int64, error)

func (*RedisCluster) Blpop

func (r *RedisCluster) Blpop(args ...string) ([]string, error)

func (*RedisCluster) BlpopTimout

func (r *RedisCluster) BlpopTimout(timeout int, keys ...string) ([]string, error)

func (*RedisCluster) Brpop

func (r *RedisCluster) Brpop(args ...string) ([]string, error)

func (*RedisCluster) BrpopTimout

func (r *RedisCluster) BrpopTimout(timeout int, keys ...string) ([]string, error)

func (*RedisCluster) Brpoplpush

func (r *RedisCluster) Brpoplpush(source, destination string, timeout int) (string, error)

func (*RedisCluster) Decr

func (r *RedisCluster) Decr(key string) (int64, error)

func (*RedisCluster) DecrBy

func (r *RedisCluster) DecrBy(key string, decrement int64) (int64, error)

func (*RedisCluster) Del

func (r *RedisCluster) Del(keys ...string) (int64, error)

<editor-fold desc="multikeycommands">

func (*RedisCluster) Echo

func (r *RedisCluster) Echo(str string) (string, error)

func (*RedisCluster) Eval

func (r *RedisCluster) Eval(script string, keyCount int, params ...string) (interface{}, error)

<editor-fold desc="scriptcommands">

func (*RedisCluster) Evalsha

func (r *RedisCluster) Evalsha(sha1 string, keyCount int, params ...string) (interface{}, error)

func (*RedisCluster) Exists

func (r *RedisCluster) Exists(keys ...string) (int64, error)

func (*RedisCluster) Expire

func (r *RedisCluster) Expire(key string, seconds int) (int64, error)

func (*RedisCluster) ExpireAt

func (r *RedisCluster) ExpireAt(key string, unixtime int64) (int64, error)

func (*RedisCluster) Geoadd

func (r *RedisCluster) Geoadd(key string, longitude, latitude float64, member string) (int64, error)

func (*RedisCluster) GeoaddByMap

func (r *RedisCluster) GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (int64, error)

func (*RedisCluster) Geodist

func (r *RedisCluster) Geodist(key string, member1, member2 string, unit ...GeoUnit) (float64, error)

func (*RedisCluster) Geohash

func (r *RedisCluster) Geohash(key string, members ...string) ([]string, error)

func (*RedisCluster) Geopos

func (r *RedisCluster) Geopos(key string, members ...string) ([]*GeoCoordinate, error)

func (*RedisCluster) Georadius

func (r *RedisCluster) Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, param ...GeoRadiusParam) ([]*GeoCoordinate, error)

func (*RedisCluster) GeoradiusByMember

func (r *RedisCluster) GeoradiusByMember(key string, member string, radius float64, unit GeoUnit, param ...GeoRadiusParam) ([]*GeoCoordinate, error)

func (*RedisCluster) Get

func (r *RedisCluster) Get(key string) (string, error)

func (*RedisCluster) GetSet

func (r *RedisCluster) GetSet(key, value string) (string, error)

func (*RedisCluster) Getbit

func (r *RedisCluster) Getbit(key string, offset int64) (bool, error)

func (*RedisCluster) Getrange

func (r *RedisCluster) Getrange(key string, startOffset, endOffset int64) (string, error)

func (*RedisCluster) Hdel

func (r *RedisCluster) Hdel(key string, fields ...string) (int64, error)

func (*RedisCluster) Hexists

func (r *RedisCluster) Hexists(key, field string) (bool, error)

func (*RedisCluster) Hget

func (r *RedisCluster) Hget(key, field string) (string, error)

func (*RedisCluster) HgetAll

func (r *RedisCluster) HgetAll(key string) (map[string]string, error)

func (*RedisCluster) HincrBy

func (r *RedisCluster) HincrBy(key, field string, value int64) (int64, error)

func (*RedisCluster) HincrByFloat

func (r *RedisCluster) HincrByFloat(key, field string, value float64) (float64, error)

func (*RedisCluster) Hkeys

func (r *RedisCluster) Hkeys(key string) ([]string, error)

func (*RedisCluster) Hlen

func (r *RedisCluster) Hlen(key string) (int64, error)

func (*RedisCluster) Hmget

func (r *RedisCluster) Hmget(key string, fields ...string) ([]string, error)

func (*RedisCluster) Hmset

func (r *RedisCluster) Hmset(key string, hash map[string]string) (string, error)

func (*RedisCluster) Hscan

func (r *RedisCluster) Hscan(key, cursor string, params ...ScanParams) (*ScanResult, error)

func (*RedisCluster) Hset

func (r *RedisCluster) Hset(key, field string, value string) (int64, error)

func (*RedisCluster) Hsetnx

func (r *RedisCluster) Hsetnx(key, field, value string) (int64, error)

func (*RedisCluster) Hvals

func (r *RedisCluster) Hvals(key string) ([]string, error)

func (*RedisCluster) Incr

func (r *RedisCluster) Incr(key string) (int64, error)

func (*RedisCluster) IncrBy

func (r *RedisCluster) IncrBy(key string, increment int64) (int64, error)

func (*RedisCluster) IncrByFloat

func (r *RedisCluster) IncrByFloat(key string, increment float64) (float64, error)

func (*RedisCluster) Keys

func (r *RedisCluster) Keys(pattern string) ([]string, error)

Deprecated do not use

func (*RedisCluster) Lindex

func (r *RedisCluster) Lindex(key string, index int64) (string, error)

func (*RedisCluster) Linsert

func (r *RedisCluster) Linsert(key string, where ListOption, pivot, value string) (int64, error)

func (*RedisCluster) Llen

func (r *RedisCluster) Llen(key string) (int64, error)

func (*RedisCluster) Lpop

func (r *RedisCluster) Lpop(key string) (string, error)

func (*RedisCluster) Lpush

func (r *RedisCluster) Lpush(key string, strings ...string) (int64, error)

func (*RedisCluster) Lpushx

func (r *RedisCluster) Lpushx(key string, strs ...string) (int64, error)

func (*RedisCluster) Lrange

func (r *RedisCluster) Lrange(key string, start, stop int64) ([]string, error)

func (*RedisCluster) Lrem

func (r *RedisCluster) Lrem(key string, count int64, value string) (int64, error)

func (*RedisCluster) Lset

func (r *RedisCluster) Lset(key string, index int64, value string) (string, error)

func (*RedisCluster) Ltrim

func (r *RedisCluster) Ltrim(key string, start, stop int64) (string, error)

func (*RedisCluster) Mget

func (r *RedisCluster) Mget(keys ...string) ([]string, error)

func (*RedisCluster) Move

func (r *RedisCluster) Move(key string, dbIndex int) (int64, error)

Deprecated

func (*RedisCluster) Mset

func (r *RedisCluster) Mset(keysvalues ...string) (string, error)

func (*RedisCluster) Msetnx

func (r *RedisCluster) Msetnx(keysvalues ...string) (int64, error)

func (*RedisCluster) Persist

func (r *RedisCluster) Persist(key string) (int64, error)

func (*RedisCluster) Pexpire

func (r *RedisCluster) Pexpire(key string, milliseconds int64) (int64, error)

func (*RedisCluster) PexpireAt

func (r *RedisCluster) PexpireAt(key string, millisecondsTimestamp int64) (int64, error)

func (*RedisCluster) Pfadd

func (r *RedisCluster) Pfadd(key string, elements ...string) (int64, error)

func (*RedisCluster) Pfcount

func (r *RedisCluster) Pfcount(keys ...string) (int64, error)

func (*RedisCluster) Pfmerge

func (r *RedisCluster) Pfmerge(destkey string, sourcekeys ...string) (string, error)

func (*RedisCluster) Psetex

func (r *RedisCluster) Psetex(key string, milliseconds int64, value string) (string, error)

func (*RedisCluster) Psubscribe

func (r *RedisCluster) Psubscribe(redisPubSub *RedisPubSub, patterns ...string) error

func (*RedisCluster) Pttl

func (r *RedisCluster) Pttl(key string) (int64, error)

func (*RedisCluster) Publish

func (r *RedisCluster) Publish(channel, message string) (int64, error)

func (*RedisCluster) RandomKey

func (r *RedisCluster) RandomKey() (string, error)

Deprecated do not use

func (*RedisCluster) Rename

func (r *RedisCluster) Rename(oldkey, newkey string) (string, error)

func (*RedisCluster) Renamenx

func (r *RedisCluster) Renamenx(oldkey, newkey string) (int64, error)

func (*RedisCluster) Rpop

func (r *RedisCluster) Rpop(key string) (string, error)

func (*RedisCluster) Rpoplpush

func (r *RedisCluster) Rpoplpush(srckey, dstkey string) (string, error)

func (*RedisCluster) Rpush

func (r *RedisCluster) Rpush(key string, strings ...string) (int64, error)

func (*RedisCluster) Rpushx

func (r *RedisCluster) Rpushx(key string, strs ...string) (int64, error)

func (*RedisCluster) Sadd

func (r *RedisCluster) Sadd(key string, members ...string) (int64, error)

func (*RedisCluster) Scan

func (r *RedisCluster) Scan(cursor string, params ...ScanParams) (*ScanResult, error)

func (*RedisCluster) Scard

func (r *RedisCluster) Scard(key string) (int64, error)

func (*RedisCluster) ScriptExists

func (r *RedisCluster) ScriptExists(key string, sha1 ...string) ([]bool, error)

func (*RedisCluster) ScriptLoad

func (r *RedisCluster) ScriptLoad(key, script string) (string, error)

func (*RedisCluster) Sdiff

func (r *RedisCluster) Sdiff(keys ...string) ([]string, error)

func (*RedisCluster) Sdiffstore

func (r *RedisCluster) Sdiffstore(dstkey string, keys ...string) (int64, error)

func (*RedisCluster) Set

func (r *RedisCluster) Set(key, value string) (string, error)

<editor-fold desc="rediscommands">

func (*RedisCluster) SetWithParams

func (r *RedisCluster) SetWithParams(key, value, nxxx string) (string, error)

func (*RedisCluster) SetWithParamsAndTime

func (r *RedisCluster) SetWithParamsAndTime(key, value, nxxx, expx string, time int64) (string, error)

func (*RedisCluster) Setbit

func (r *RedisCluster) Setbit(key string, offset int64, value string) (bool, error)

func (*RedisCluster) SetbitWithBool

func (r *RedisCluster) SetbitWithBool(key string, offset int64, value bool) (bool, error)

func (*RedisCluster) Setex

func (r *RedisCluster) Setex(key string, seconds int, value string) (string, error)

func (*RedisCluster) Setnx

func (r *RedisCluster) Setnx(key, value string) (int64, error)

func (*RedisCluster) Setrange

func (r *RedisCluster) Setrange(key string, offset int64, value string) (int64, error)

func (*RedisCluster) Sinter

func (r *RedisCluster) Sinter(keys ...string) ([]string, error)

func (*RedisCluster) Sinterstore

func (r *RedisCluster) Sinterstore(dstkey string, keys ...string) (int64, error)

func (*RedisCluster) Sismember

func (r *RedisCluster) Sismember(key string, member string) (bool, error)

func (*RedisCluster) Smembers

func (r *RedisCluster) Smembers(key string) ([]string, error)

func (*RedisCluster) Smove

func (r *RedisCluster) Smove(srckey, dstkey, member string) (int64, error)

func (*RedisCluster) Sort

func (r *RedisCluster) Sort(key string, sortingParameters ...SortingParams) ([]string, error)

func (*RedisCluster) SortMulti

func (r *RedisCluster) SortMulti(key, dstkey string, sortingParameters ...SortingParams) (int64, error)

func (*RedisCluster) Spop

func (r *RedisCluster) Spop(key string) (string, error)

func (*RedisCluster) SpopBatch

func (r *RedisCluster) SpopBatch(key string, count int64) ([]string, error)

func (*RedisCluster) Srandmember

func (r *RedisCluster) Srandmember(key string) (string, error)

func (*RedisCluster) SrandmemberBatch

func (r *RedisCluster) SrandmemberBatch(key string, count int) ([]string, error)

func (*RedisCluster) Srem

func (r *RedisCluster) Srem(key string, members ...string) (int64, error)

func (*RedisCluster) Sscan

func (r *RedisCluster) Sscan(key, cursor string, params ...ScanParams) (*ScanResult, error)

func (*RedisCluster) Strlen

func (r *RedisCluster) Strlen(key string) (int64, error)

func (*RedisCluster) Subscribe

func (r *RedisCluster) Subscribe(redisPubSub *RedisPubSub, channels ...string) error

func (*RedisCluster) Substr

func (r *RedisCluster) Substr(key string, start, end int) (string, error)

func (*RedisCluster) Sunion

func (r *RedisCluster) Sunion(keys ...string) ([]string, error)

func (*RedisCluster) Sunionstore

func (r *RedisCluster) Sunionstore(dstkey string, keys ...string) (int64, error)

func (*RedisCluster) Ttl

func (r *RedisCluster) Ttl(key string) (int64, error)

func (*RedisCluster) Type

func (r *RedisCluster) Type(key string) (string, error)

func (*RedisCluster) Unwatch

func (r *RedisCluster) Unwatch() (string, error)

Deprecated do not use

func (*RedisCluster) Watch

func (r *RedisCluster) Watch(keys ...string) (string, error)

Deprecated do not use

func (*RedisCluster) Zadd

func (r *RedisCluster) Zadd(key string, score float64, member string, params ...ZAddParams) (int64, error)

func (*RedisCluster) ZaddByMap

func (r *RedisCluster) ZaddByMap(key string, scoreMembers map[string]float64, params ...ZAddParams) (int64, error)

func (*RedisCluster) Zcard

func (r *RedisCluster) Zcard(key string) (int64, error)

func (*RedisCluster) Zcount

func (r *RedisCluster) Zcount(key string, min string, max string) (int64, error)

func (*RedisCluster) Zincrby

func (r *RedisCluster) Zincrby(key string, score float64, member string, params ...ZAddParams) (float64, error)

func (*RedisCluster) Zinterstore

func (r *RedisCluster) Zinterstore(dstkey string, sets ...string) (int64, error)

func (*RedisCluster) ZinterstoreWithParams

func (r *RedisCluster) ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)

func (*RedisCluster) Zlexcount

func (r *RedisCluster) Zlexcount(key, min, max string) (int64, error)

func (*RedisCluster) Zrange

func (r *RedisCluster) Zrange(key string, start, end int64) ([]string, error)

func (*RedisCluster) ZrangeByLex

func (r *RedisCluster) ZrangeByLex(key, min, max string) ([]string, error)

func (*RedisCluster) ZrangeByLexBatch

func (r *RedisCluster) ZrangeByLexBatch(key, min, max string, offset, count int) ([]string, error)

func (*RedisCluster) ZrangeByScore

func (r *RedisCluster) ZrangeByScore(key string, min string, max string) ([]string, error)

func (*RedisCluster) ZrangeByScoreBatch

func (r *RedisCluster) ZrangeByScoreBatch(key string, min string, max string, offset int, count int) ([]string, error)

func (*RedisCluster) ZrangeByScoreWithScores

func (r *RedisCluster) ZrangeByScoreWithScores(key, min, max string) ([]Tuple, error)

func (*RedisCluster) ZrangeByScoreWithScoresBatch

func (r *RedisCluster) ZrangeByScoreWithScoresBatch(key, min, max string, offset, count int) ([]Tuple, error)

func (*RedisCluster) ZrangeWithScores

func (r *RedisCluster) ZrangeWithScores(key string, start, end int64) ([]Tuple, error)

func (*RedisCluster) Zrank

func (r *RedisCluster) Zrank(key, member string) (int64, error)

func (*RedisCluster) Zrem

func (r *RedisCluster) Zrem(key string, member ...string) (int64, error)

func (*RedisCluster) ZremrangeByLex

func (r *RedisCluster) ZremrangeByLex(key, min, max string) (int64, error)

func (*RedisCluster) ZremrangeByRank

func (r *RedisCluster) ZremrangeByRank(key string, start, end int64) (int64, error)

func (*RedisCluster) ZremrangeByScore

func (r *RedisCluster) ZremrangeByScore(key, start, end string) (int64, error)

func (*RedisCluster) Zrevrange

func (r *RedisCluster) Zrevrange(key string, start, end int64) ([]string, error)

func (*RedisCluster) ZrevrangeByLex

func (r *RedisCluster) ZrevrangeByLex(key, max, min string) ([]string, error)

func (*RedisCluster) ZrevrangeByLexBatch

func (r *RedisCluster) ZrevrangeByLexBatch(key, max, min string, offset, count int) ([]string, error)

func (*RedisCluster) ZrevrangeByScore

func (r *RedisCluster) ZrevrangeByScore(key string, max string, min string) ([]string, error)

func (*RedisCluster) ZrevrangeByScoreWithScores

func (r *RedisCluster) ZrevrangeByScoreWithScores(key, max, min string) ([]Tuple, error)

func (*RedisCluster) ZrevrangeByScoreWithScoresBatch

func (r *RedisCluster) ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) ([]Tuple, error)

func (*RedisCluster) ZrevrangeWithScores

func (r *RedisCluster) ZrevrangeWithScores(key string, start, end int64) ([]Tuple, error)

func (*RedisCluster) Zrevrank

func (r *RedisCluster) Zrevrank(key, member string) (int64, error)

func (*RedisCluster) Zscan

func (r *RedisCluster) Zscan(key, cursor string, params ...ScanParams) (*ScanResult, error)

func (*RedisCluster) Zscore

func (r *RedisCluster) Zscore(key, member string) (float64, error)

func (*RedisCluster) Zunionstore

func (r *RedisCluster) Zunionstore(dstkey string, sets ...string) (int64, error)

func (*RedisCluster) ZunionstoreWithParams

func (r *RedisCluster) ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)

type RedisClusterCommand

type RedisClusterCommand struct {
	MaxAttempts       int
	ConnectionHandler *RedisClusterConnectionHandler
	// contains filtered or unexported fields
}

func NewRedisClusterCommand

func NewRedisClusterCommand(maxAttempts int, connectionHandler *RedisClusterConnectionHandler) *RedisClusterCommand

type RedisClusterConnectionHandler

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

func NewRedisClusterConnectionHandler

func NewRedisClusterConnectionHandler(nodes []string, connectionTimeout, soTimeout int, password string, poolConfig PoolConfig) *RedisClusterConnectionHandler

type RedisClusterHashTagUtil

type RedisClusterHashTagUtil struct {
}

func NewRedisClusterHashTagUtil

func NewRedisClusterHashTagUtil() *RedisClusterHashTagUtil

type RedisClusterInfoCache

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

func NewRedisClusterInfoCache

func NewRedisClusterInfoCache(connectionTimeout, soTimeout int, password string, poolConfig PoolConfig) *RedisClusterInfoCache

type RedisCommands

type RedisCommands interface {
	Set(key, value string) (string, error)
	SetWithParamsAndTime(key, value, nxxx, expx string, time int64) (string, error)
	SetWithParams(key, value, nxxx string) (string, error)
	Get(key string) (string, error)
	//Exists(key string) ([]string, error)
	Persist(key string) (int64, error)
	Type(key string) (string, error)
	Expire(key string, seconds int) (int64, error)
	Pexpire(key string, milliseconds int64) (int64, error)
	ExpireAt(key string, unixtime int64) (int64, error)
	PexpireAt(key string, millisecondsTimestamp int64) (int64, error)
	Ttl(key string) (int64, error)
	Pttl(key string) (int64, error)
	SetbitWithBool(key string, offset int64, value bool) (bool, error)
	Setbit(key string, offset int64, value string) (bool, error)
	Getbit(key string, offset int64) (bool, error)
	Setrange(key string, offset int64, value string) (int64, error)
	Getrange(key string, startOffset, endOffset int64) (string, error)
	GetSet(key, value string) (string, error)

	Setnx(key, value string) (int64, error)
	Setex(key string, seconds int, value string) (string, error)
	Psetex(key string, milliseconds int64, value string) (string, error)
	DecrBy(key string, decrement int64) (int64, error)
	Decr(key string) (int64, error)
	IncrBy(key string, increment int64) (int64, error)
	IncrByFloat(key string, increment float64) (float64, error)
	Incr(key string) (int64, error)
	Append(key, value string) (int64, error)
	Substr(key string, start, end int) (string, error)

	Hset(key, field string, value string) (int64, error)
	Hget(key, field string) (string, error)
	Hsetnx(key, field, value string) (int64, error)
	Hmset(key string, hash map[string]string) (string, error)
	Hmget(key string, fields ...string) ([]string, error)
	HincrBy(key, field string, value int64) (int64, error)
	HincrByFloat(key, field string, value float64) (float64, error)
	Hexists(key, field string) (bool, error)
	Hdel(key string, fields ...string) (int64, error)
	Hlen(key string) (int64, error)
	Hkeys(key string) ([]string, error)
	Hvals(key string) ([]string, error)
	HgetAll(key string) (map[string]string, error)

	Rpush(key string, strings ...string) (int64, error)
	Lpush(key string, strings ...string) (int64, error)
	Llen(key string) (int64, error)
	Lrange(key string, start, stop int64) ([]string, error)
	Ltrim(key string, start, stop int64) (string, error)
	Lindex(key string, index int64) (string, error)
	Lset(key string, index int64, value string) (string, error)
	Lrem(key string, count int64, value string) (int64, error)
	Lpop(key string) (string, error)
	Rpop(key string) (string, error)
	Sadd(key string, members ...string) (int64, error)
	Smembers(key string) ([]string, error)
	Srem(key string, members ...string) (int64, error)
	Spop(key string) (string, error)
	SpopBatch(key string, count int64) ([]string, error)

	Scard(key string) (int64, error)
	Sismember(key string, member string) (bool, error)
	Srandmember(key string) (string, error)
	SrandmemberBatch(key string, count int) ([]string, error)
	Strlen(key string) (int64, error)

	//Zadd(key string, score float64, member string) (int64, error)
	Zadd(key string, score float64, member string, params ...ZAddParams) (int64, error)
	//Zadd(key string, scoreMembers map[string]float64) (int64, error)
	ZaddByMap(key string, scoreMembers map[string]float64, params ...ZAddParams) (int64, error)
	Zrange(key string, start, end int64) ([]string, error)
	Zrem(key string, member ...string) (int64, error)
	//Zincrby(key string, score float64, member string) (float64, error)
	Zincrby(key string, score float64, member string, params ...ZAddParams) (float64, error)
	Zrank(key, member string) (int64, error)
	Zrevrank(key, member string) (int64, error)
	Zrevrange(key string, start, end int64) ([]string, error)
	ZrangeWithScores(key string, start, end int64) ([]Tuple, error)
	ZrevrangeWithScores(key string, start, end int64) ([]Tuple, error)
	Zcard(key string) (int64, error)
	Zscore(key, member string) (float64, error)
	//Sort(key string) ([]string, error)
	Sort(key string, sortingParameters ...SortingParams) ([]string, error)
	//Zcount(key string, min float64, max float64) (int64, error)
	Zcount(key string, min string, max string) (int64, error)
	//ZrangeByScore(key string, min float64, max float64) ([]string, error)
	ZrangeByScore(key string, min string, max string) ([]string, error)
	//ZrevrangeByScore(key string, max float64, min float64) ([]string, error)
	//ZrangeByScoreBatch(key string, min float64, max float64, offset int, count int) ([]string, error)
	ZrevrangeByScore(key string, max string, min string) ([]string, error)
	ZrangeByScoreBatch(key string, min string, max string, offset int, count int) ([]string, error)
	//ZrevrangeByScore(key string, max float64, min float64, offset int, count int) ([]string, error)
	//ZrangeByScoreWithScores(key string, min float64, max float64) ([]Tuple, error)
	//ZrevrangeByScoreWithScores(key string, max float64, min float64) ([]Tuple, error)
	//ZrangeByScoreWithScoresBatch(key string, min float64, max float64, offset int, count int) ([]Tuple, error)
	//Zcore(key, max, min string, offset, count int) ([]string, error)
	ZrangeByScoreWithScores(key, min, max string) ([]Tuple, error)
	ZrevrangeByScoreWithScores(key, max, min string) ([]Tuple, error)
	ZrangeByScoreWithScoresBatch(key, min, max string, offset, count int) ([]Tuple, error)
	//ZrevrangeByScoreWithScores(key string, max float64, min float64, offset int, count int) ([]Tuple, error)
	ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) ([]Tuple, error)
	ZremrangeByRank(key string, start, end int64) (int64, error)
	//ZremrangeByScore(key string, start float64, end float64) (int64, error)
	ZremrangeByScore(key, start, end string) (int64, error)
	Zlexcount(key, min, max string) (int64, error)
	ZrangeByLex(key, min, max string) ([]string, error)
	ZrangeByLexBatch(key, min, max string, offset, count int) ([]string, error)
	ZrevrangeByLex(key, max, min string) ([]string, error)
	ZrevrangeByLexBatch(key, max, min string, offset, count int) ([]string, error)
	ZremrangeByLex(key, min, max string) (int64, error)
	Linsert(key string, where ListOption, pivot, value string) (int64, error)
	Lpushx(key string, String ...string) (int64, error)
	Rpushx(key string, String ...string) (int64, error)
	//Brpop(timeout int, key string) ([]string, error)
	//Del(key string) (int64, error)
	Echo(str string) (string, error)
	Move(key string, dbIndex int) (int64, error)
	Bitcount(key string) (int64, error)
	BitcountRange(key string, start int64, end int64) (int64, error)
	//Bitpos(key string, value bool) (int64, error)
	Bitpos(key string, value bool, params ...BitPosParams) (int64, error)
	//Hscan(key string, cursor string) (ScanResult, error)
	Hscan(key, cursor string, params ...ScanParams) (*ScanResult, error)
	//Sscan(key string, cursor string) (ScanResult, error)
	Sscan(key, cursor string, params ...ScanParams) (*ScanResult, error)
	//Zscan(key string, cursor string) (ScanResult, error)
	Zscan(key, cursor string, params ...ScanParams) (*ScanResult, error)
	Pfadd(key string, elements ...string) (int64, error)

	// Geo Commands
	Geoadd(key string, longitude, latitude float64, member string) (int64, error)
	GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (int64, error)
	//Geodist(key string, member1, member2 string) (float64, error)
	Geodist(key string, member1, member2 string, unit ...GeoUnit) (float64, error)
	Geohash(key string, members ...string) ([]string, error)
	Geopos(key string, members ...string) ([]*GeoCoordinate, error)
	//Georadius(key string, longitude float64, latitude float64, radius float64, unit GeoUnit) ([]GeoCoordinate, error)
	Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, param ...GeoRadiusParam) ([]*GeoCoordinate, error)
	//GeoradiusByMember(key string, member string, radius float64, unit GeoUnit) ([]GeoCoordinate, error)
	GeoradiusByMember(key string, member string, radius float64, unit GeoUnit, param ...GeoRadiusParam) ([]*GeoCoordinate, error)
	Bitfield(key string, arguments ...string) ([]int64, error)
}

type RedisInputStream

type RedisInputStream struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

func NewRedisInputStream

func NewRedisInputStream(br *bufio.Reader) *RedisInputStream

type RedisOutputStream

type RedisOutputStream struct {
	*bufio.Writer
	// contains filtered or unexported fields
}

func NewRedisOutputStream

func NewRedisOutputStream(bw *bufio.Writer) *RedisOutputStream

type RedisPipeline

type RedisPipeline interface {
	Set(key, value string) (*Response, error)
	SetWithParamsAndTime(key, value, nxxx, expx string, time int64) (*Response, error)
	SetWithParams(key, value, nxxx string) (*Response, error)
	Get(key string) (*Response, error)
	//Exists(key string) (*Response, error)
	Persist(key string) (*Response, error)
	Type(key string) (*Response, error)
	Expire(key string, seconds int) (*Response, error)
	Pexpire(key string, milliseconds int64) (*Response, error)
	ExpireAt(key string, unixtime int64) (*Response, error)
	PexpireAt(key string, millisecondsTimestamp int64) (*Response, error)
	Ttl(key string) (*Response, error)
	Pttl(key string) (*Response, error)
	SetbitWithBool(key string, offset int64, value bool) (*Response, error)
	Setbit(key string, offset int64, value string) (*Response, error)
	Getbit(key string, offset int64) (*Response, error)
	Setrange(key string, offset int64, value string) (*Response, error)
	Getrange(key string, startOffset, endOffset int64) (*Response, error)
	GetSet(key, value string) (*Response, error)

	Setnx(key, value string) (*Response, error)
	Setex(key string, seconds int, value string) (*Response, error)
	Psetex(key string, milliseconds int64, value string) (*Response, error)
	DecrBy(key string, decrement int64) (*Response, error)
	Decr(key string) (*Response, error)
	IncrBy(key string, increment int64) (*Response, error)
	IncrByFloat(key string, increment float64) (*Response, error)
	Incr(key string) (*Response, error)
	Append(key, value string) (*Response, error)
	Substr(key string, start, end int) (*Response, error)

	Hset(key, field string, value string) (*Response, error)
	Hget(key, field string) (*Response, error)
	Hsetnx(key, field, value string) (*Response, error)
	Hmset(key string, hash map[string]string) (*Response, error)
	Hmget(key string, fields ...string) (*Response, error)
	HincrBy(key, field string, value int64) (*Response, error)
	HincrByFloat(key, field string, value float64) (*Response, error)
	Hexists(key, field string) (*Response, error)
	Hdel(key string, fields ...string) (*Response, error)
	Hlen(key string) (*Response, error)
	Hkeys(key string) (*Response, error)
	Hvals(key string) (*Response, error)
	HgetAll(key string) (*Response, error)

	Rpush(key string, strings ...string) (*Response, error)
	Lpush(key string, strings ...string) (*Response, error)
	Llen(key string) (*Response, error)
	Lrange(key string, start, stop int64) (*Response, error)
	Ltrim(key string, start, stop int64) (*Response, error)
	Lindex(key string, index int64) (*Response, error)
	Lset(key string, index int64, value string) (*Response, error)
	Lrem(key string, count int64, value string) (*Response, error)
	Lpop(key string) (*Response, error)
	Rpop(key string) (*Response, error)
	Sadd(key string, members ...string) (*Response, error)
	Smembers(key string) (*Response, error)
	Srem(key string, members ...string) (*Response, error)
	Spop(key string) (*Response, error)
	SpopBatch(key string, count int64) (*Response, error)

	Scard(key string) (*Response, error)
	Sismember(key string, member string) (*Response, error)
	Srandmember(key string) (*Response, error)
	SrandmemberBatch(key string, count int) (*Response, error)
	Strlen(key string) (*Response, error)

	//Zadd(key string, score float64, member string) (*Response, error)
	Zadd(key string, score float64, member string, params ...ZAddParams) (*Response, error)
	//Zadd(key string, scoreMembers map[string]float64) (*Response, error)
	ZaddByMap(key string, scoreMembers map[string]float64, params ...ZAddParams) (*Response, error)
	Zrange(key string, start, end int64) (*Response, error)
	Zrem(key string, member ...string) (*Response, error)
	//Zincrby(key string, score float64, member string) (*Response, error)
	Zincrby(key string, score float64, member string, params ...ZAddParams) (*Response, error)
	Zrank(key, member string) (*Response, error)
	Zrevrank(key, member string) (*Response, error)
	Zrevrange(key string, start, end int64) (*Response, error)
	ZrangeWithScores(key string, start, end int64) (*Response, error)
	ZrevrangeWithScores(key string, start, end int64) (*Response, error)
	Zcard(key string) (*Response, error)
	Zscore(key, member string) (*Response, error)
	//Sort(key string) (*Response, error)
	Sort(key string, sortingParameters ...SortingParams) (*Response, error)
	//Zcount(key string, min float64, max float64) (*Response, error)
	Zcount(key string, min string, max string) (*Response, error)
	//ZrangeByScore(key string, min float64, max float64) (*Response, error)
	ZrangeByScore(key string, min string, max string) (*Response, error)
	//ZrevrangeByScore(key string, max float64, min float64) (*Response, error)
	//ZrangeByScoreBatch(key string, min float64, max float64, offset int, count int) (*Response, error)
	ZrevrangeByScore(key string, max string, min string) (*Response, error)
	ZrangeByScoreBatch(key string, min string, max string, offset int, count int) (*Response, error)
	//ZrevrangeByScore(key string, max float64, min float64, offset int, count int) (*Response, error)
	//ZrangeByScoreWithScores(key string, min float64, max float64) (*Response, error)
	//ZrevrangeByScoreWithScores(key string, max float64, min float64) (*Response, error)
	//ZrangeByScoreWithScoresBatch(key string, min float64, max float64, offset int, count int) (*Response, error)
	//Zcore(key, max, min string, offset, count int) (*Response, error)
	ZrangeByScoreWithScores(key, min, max string) (*Response, error)
	ZrevrangeByScoreWithScores(key, max, min string) (*Response, error)
	ZrangeByScoreWithScoresBatch(key, min, max string, offset, count int) (*Response, error)
	//ZrevrangeByScoreWithScores(key string, max float64, min float64, offset int, count int) (*Response, error)
	ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) (*Response, error)
	ZremrangeByRank(key string, start, end int64) (*Response, error)
	//ZremrangeByScore(key string, start float64, end float64) (*Response, error)
	ZremrangeByScore(key, start, end string) (*Response, error)
	Zlexcount(key, min, max string) (*Response, error)
	ZrangeByLex(key, min, max string) (*Response, error)
	ZrangeByLexBatch(key, min, max string, offset, count int) (*Response, error)
	ZrevrangeByLex(key, max, min string) (*Response, error)
	ZrevrangeByLexBatch(key, max, min string, offset, count int) (*Response, error)
	ZremrangeByLex(key, min, max string) (*Response, error)
	Linsert(key string, where ListOption, pivot, value string) (*Response, error)
	Lpushx(key string, String ...string) (*Response, error)
	Rpushx(key string, String ...string) (*Response, error)
	//Brpop(timeout int, key string) (*Response, error)
	//Del(key string) (*Response, error)
	Echo(str string) (*Response, error)
	Move(key string, dbIndex int) (*Response, error)
	Bitcount(key string) (*Response, error)
	BitcountRange(key string, start int64, end int64) (*Response, error)
	//Bitpos(key string, value bool) (*Response, error)
	Bitpos(key string, value bool, params ...BitPosParams) (*Response, error)
	//Hscan(key string, cursor string) (ScanResult, error)
	Hscan(key, cursor string, params ...ScanParams) (*Response, error)
	//Sscan(key string, cursor string) (ScanResult, error)
	Sscan(key, cursor string, params ...ScanParams) (*Response, error)
	//Zscan(key string, cursor string) (ScanResult, error)
	Zscan(key, cursor string, params ...ScanParams) (*Response, error)
	Pfadd(key string, elements ...string) (*Response, error)

	// Geo Commands
	Geoadd(key string, longitude, latitude float64, member string) (*Response, error)
	GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (*Response, error)
	//Geodist(key string, member1, member2 string) (*Response, error)
	Geodist(key string, member1, member2 string, unit ...GeoUnit) (*Response, error)
	Geohash(key string, members ...string) (*Response, error)
	Geopos(key string, members ...string) (*Response, error)
	//Georadius(key string, longitude float64, latitude float64, radius float64, unit GeoUnit) ([]GeoCoordinate, error)
	Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, param ...GeoRadiusParam) (*Response, error)
	//GeoradiusByMember(key string, member string, radius float64, unit GeoUnit) ([]GeoCoordinate, error)
	GeoradiusByMember(key string, member string, radius float64, unit GeoUnit, param ...GeoRadiusParam) (*Response, error)
	Bitfield(key string, arguments ...string) (*Response, error)
}

type RedisPubSub

type RedisPubSub struct {
	Redis          *Redis
	OnMessage      func(channel, message string)
	OnPMessage     func(pattern string, channel, message string)
	OnSubscribe    func(channel string, subscribedChannels int)
	OnUnsubscribe  func(channel string, subscribedChannels int)
	OnPUnsubscribe func(pattern string, subscribedChannels int)
	OnPSubscribe   func(pattern string, subscribedChannels int)
	OnPong         func(channel string)
	// contains filtered or unexported fields
}

func (*RedisPubSub) Psubscribe

func (r *RedisPubSub) Psubscribe(channels ...string) error

func (*RedisPubSub) Punsubscribe

func (r *RedisPubSub) Punsubscribe(channels ...string) error

func (*RedisPubSub) Subscribe

func (r *RedisPubSub) Subscribe(channels ...string) error

func (*RedisPubSub) Unsubscribe

func (r *RedisPubSub) Unsubscribe(channels ...string) error

type Reset

type Reset struct {
	Name string
}

func (Reset) GetRaw

func (g Reset) GetRaw() []byte

type Response

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

func NewResponse

func NewResponse() *Response

func (*Response) Get

func (r *Response) Get() (interface{}, error)

func (*Response) Set

func (r *Response) Set(data interface{})

type ScanParams

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

func NewScanParams

func NewScanParams() *ScanParams

type ScanResult

type ScanResult struct {
	Cursor  string
	Results []string
}

func ObjectArrToScanResultReply

func ObjectArrToScanResultReply(reply []interface{}, err error) (*ScanResult, error)

func ToScanResultReply

func ToScanResultReply(reply interface{}, err error) (*ScanResult, error)

type ScriptingCommands

type ScriptingCommands interface {
	Eval(script string, keyCount int, params ...string) (interface{}, error)
	//Eval(script string, keys, args []string) (interface{}, error)
	//Eval(script string) (interface{}, error)
	//Evalsha(script string) (interface{}, error)
	//Evalsha(sha1 string, keys, args []string) (interface{}, error)
	Evalsha(sha1 string, keyCount int, params ...string) (interface{}, error)
	//ScriptExists(sha1 string) (bool, error)
	ScriptExists(sha1 ...string) ([]bool, error)
	ScriptLoad(script string) (string, error)
}

type ScriptingCommandsPipeline

type ScriptingCommandsPipeline interface {
	Eval(script string, keyCount int, params ...string) (*Response, error)
	Evalsha(sha1 string, keyCount int, params ...string) (*Response, error)
}

type SentinelCommands

type SentinelCommands interface {
	SentinelMasters() ([]map[string]string, error)
	SentinelGetMasterAddrByName(masterName string) ([]string, error)
	SentinelReset(pattern string) (int64, error)
	SentinelSlaves(masterName string) ([]map[string]string, error)
	SentinelFailover(masterName string) (string, error)
	SentinelMonitor(masterName, ip string, port, quorum int) (string, error)
	SentinelRemove(masterName string) (string, error)
	SentinelSet(masterName string, parameterMap map[string]string) (string, error)
}

type ShardInfo

type ShardInfo struct {
	Host              string
	Port              int
	ConnectionTimeout int
	SoTimeout         int
	Password          string
	Db                int
	IsInMulti         bool
	IsInWatch         bool
	Ssl               bool
}

type Slowlog

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

type SortingParams

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

type Transaction

type Transaction struct {
	*MultiKeyPipelineBase
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(client *Client) *Transaction

func (*Transaction) Clear

func (t *Transaction) Clear() (string, error)

func (*Transaction) Discard

func (t *Transaction) Discard() (string, error)

func (*Transaction) Exec

func (t *Transaction) Exec() ([]interface{}, error)

func (*Transaction) ExecGetResponse

func (t *Transaction) ExecGetResponse() ([]*Response, error)

type Tuple

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

func StringArrToTupleReply

func StringArrToTupleReply(reply []string, err error) ([]Tuple, error)

func ToTupleArrayReply

func ToTupleArrayReply(reply interface{}, err error) ([]Tuple, error)

type ZAddParams

type ZAddParams struct {
	XX bool
	NX bool
	CH bool
	// contains filtered or unexported fields
}

type ZParams

type ZParams struct {
	Name string
	// contains filtered or unexported fields
}

func (ZParams) GetParams

func (g ZParams) GetParams() [][]byte

func (ZParams) GetRaw

func (g ZParams) GetRaw() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL