Documentation ¶
Overview ¶
godis
Index ¶
- Constants
- Variables
- func BoolToByteArray(a bool) []byte
- func ByteArrToStringReply(reply []byte, err error) (string, error)
- func ByteArrayToFloat64(bytes []byte) float64
- func ByteArrayToInt64(bytes []byte) uint64
- func Float64ToByteArray(a float64) []byte
- func Int64ToBoolReply(reply int64, err error) (bool, error)
- func Int64ToByteArray(a int64) []byte
- func IntToByteArray(a int) []byte
- func NewClusterLocker(option *ClusterOption, lockOption *LockOption) *clusterLocker
- func NewLocker(option *Option, lockOption *LockOption) *locker
- func ObjectArrToMapArrayReply(reply []interface{}, err error) ([]map[string]string, error)
- func ObjectToEvalResult(reply interface{}, err error) (interface{}, error)
- func StringArrayToByteArray(arr []string) [][]byte
- func StringArrayToMapReply(reply []string, err error) (map[string]string, error)
- func StringStringArrayToByteArray(str string, arr []string) [][]byte
- func StringStringArrayToStringArray(str string, arr []string) []string
- func StringToFloat64Reply(reply string, err error) (float64, error)
- func ToBoolArrayReply(reply interface{}, err error) ([]bool, error)
- func ToBoolReply(reply interface{}, err error) (bool, error)
- func ToFloat64Reply(reply interface{}, err error) (float64, error)
- func ToInt64ArrayReply(reply interface{}, err error) ([]int64, error)
- func ToInt64Reply(reply interface{}, err error) (int64, error)
- func ToMapReply(reply interface{}, err error) (map[string]string, error)
- func ToStringArrayReply(reply interface{}, err error) ([]string, error)
- func ToStringReply(reply interface{}, err error) (string, error)
- type AskDataError
- type BitOP
- type BitPosParams
- type Builder
- type BusyError
- type ClusterError
- type ClusterMaxAttemptsError
- type ClusterOperationError
- type ClusterOption
- type ConnectError
- type DataError
- type DebugParams
- type GeoCoordinate
- type GeoRadiusParam
- func (g GeoRadiusParam) Contains(key string) bool
- func (p *GeoRadiusParam) Count(count int) *GeoRadiusParam
- func (g GeoRadiusParam) GetParams(args [][]byte) [][]byte
- func (p *GeoRadiusParam) SortAscending() *GeoRadiusParam
- func (p *GeoRadiusParam) SortDescending() *GeoRadiusParam
- func (p *GeoRadiusParam) WithCoord() *GeoRadiusParam
- func (p *GeoRadiusParam) WithDist() *GeoRadiusParam
- type GeoRadiusResponse
- type GeoUnit
- type ListOption
- type LockOption
- type MovedDataError
- type NoReachableClusterNodeError
- type NoScriptError
- type Option
- type Pool
- type PoolConfig
- type RedirectError
- type Redis
- func (r *Redis) Append(key, value string) (int64, error)
- func (r *Redis) Asking() (string, error)
- func (r *Redis) Auth(password string) (string, error)
- func (r *Redis) Bgrewriteaof() (string, error)
- func (r *Redis) Bgsave() (string, error)
- func (r *Redis) Bitcount(key string) (int64, error)
- func (r *Redis) BitcountRange(key string, start, end int64) (int64, error)
- func (r *Redis) Bitfield(key string, arguments ...string) ([]int64, error)
- func (r *Redis) Bitop(op BitOP, destKey string, srcKeys ...string) (int64, error)
- func (r *Redis) Bitpos(key string, value bool, params ...BitPosParams) (int64, error)
- func (r *Redis) Blpop(args ...string) ([]string, error)
- func (r *Redis) BlpopTimout(timeout int, keys ...string) ([]string, error)
- func (r *Redis) Brpop(args ...string) ([]string, error)
- func (r *Redis) BrpopTimout(timeout int, keys ...string) ([]string, error)
- func (r *Redis) Brpoplpush(source, destination string, timeout int) (string, error)
- func (r *Redis) Close() error
- func (r *Redis) ClusterAddSlots(slots ...int) (string, error)
- func (r *Redis) ClusterCountKeysInSlot(slot int) (int64, error)
- func (r *Redis) ClusterDelSlots(slots ...int) (string, error)
- func (r *Redis) ClusterFailover() (string, error)
- func (r *Redis) ClusterFlushSlots() (string, error)
- func (r *Redis) ClusterForget(nodeId string) (string, error)
- func (r *Redis) ClusterGetKeysInSlot(slot int, count int) ([]string, error)
- func (r *Redis) ClusterInfo() (string, error)
- func (r *Redis) ClusterKeySlot(key string) (int64, error)
- func (r *Redis) ClusterMeet(ip string, port int) (string, error)
- func (r *Redis) ClusterNodes() (string, error)
- func (r *Redis) ClusterReplicate(nodeId string) (string, error)
- func (r *Redis) ClusterReset(resetType Reset) (string, error)
- func (r *Redis) ClusterSaveConfig() (string, error)
- func (r *Redis) ClusterSetSlotImporting(slot int, nodeId string) (string, error)
- func (r *Redis) ClusterSetSlotMigrating(slot int, nodeId string) (string, error)
- func (r *Redis) ClusterSetSlotNode(slot int, nodeId string) (string, error)
- func (r *Redis) ClusterSetSlotStable(slot int) (string, error)
- func (r *Redis) ClusterSlaves(nodeId string) ([]string, error)
- func (r *Redis) ClusterSlots() ([]interface{}, error)
- func (r *Redis) ConfigGet(pattern string) ([]string, error)
- func (r *Redis) ConfigResetStat() (string, error)
- func (r *Redis) ConfigSet(parameter, value string) (string, error)
- func (r *Redis) Connect() error
- func (r *Redis) DbSize() (int64, error)
- func (r *Redis) Debug(params DebugParams) (string, error)
- func (r *Redis) Decr(key string) (int64, error)
- func (r *Redis) DecrBy(key string, decrement int64) (int64, error)
- func (r *Redis) Del(key ...string) (int64, error)
- func (r *Redis) Echo(string string) (string, error)
- func (r *Redis) Eval(script string, keyCount int, params ...string) (interface{}, error)
- func (r *Redis) EvalByKeyArgs(script string, keys []string, args []string) (interface{}, error)
- func (r *Redis) Evalsha(sha1 string, keyCount int, params ...string) (interface{}, error)
- func (r *Redis) Exists(keys ...string) (int64, error)
- func (r *Redis) Expire(key string, seconds int) (int64, error)
- func (r *Redis) ExpireAt(key string, unixtime int64) (int64, error)
- func (r *Redis) FlushAll() (string, error)
- func (r *Redis) FlushDB() (string, error)
- func (r *Redis) Geoadd(key string, longitude, latitude float64, member string) (int64, error)
- func (r *Redis) GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (int64, error)
- func (r *Redis) Geodist(key, member1, member2 string, unit ...GeoUnit) (float64, error)
- func (r *Redis) Geohash(key string, members ...string) ([]string, error)
- func (r *Redis) Geopos(key string, members ...string) ([]*GeoCoordinate, error)
- func (r *Redis) Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, ...) ([]GeoRadiusResponse, error)
- func (r *Redis) GeoradiusByMember(key, member string, radius float64, unit GeoUnit, param ...*GeoRadiusParam) ([]GeoRadiusResponse, error)
- func (r *Redis) Get(key string) (string, error)
- func (r *Redis) GetSet(key, value string) (string, error)
- func (r *Redis) Getbit(key string, offset int64) (bool, error)
- func (r *Redis) Getrange(key string, startOffset, endOffset int64) (string, error)
- func (r *Redis) Hdel(key string, fields ...string) (int64, error)
- func (r *Redis) Hexists(key, field string) (bool, error)
- func (r *Redis) Hget(key, field string) (string, error)
- func (r *Redis) HgetAll(key string) (map[string]string, error)
- func (r *Redis) HincrBy(key, field string, value int64) (int64, error)
- func (r *Redis) HincrByFloat(key, field string, value float64) (float64, error)
- func (r *Redis) Hkeys(key string) ([]string, error)
- func (r *Redis) Hlen(key string) (int64, error)
- func (r *Redis) Hmget(key string, fields ...string) ([]string, error)
- func (r *Redis) Hmset(key string, hash map[string]string) (string, error)
- func (r *Redis) Hscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *Redis) Hset(key, field, value string) (int64, error)
- func (r *Redis) Hsetnx(key, field, value string) (int64, error)
- func (r *Redis) Hvals(key string) ([]string, error)
- func (r *Redis) Incr(key string) (int64, error)
- func (r *Redis) IncrBy(key string, increment int64) (int64, error)
- func (r *Redis) IncrByFloat(key string, increment float64) (float64, error)
- func (r *Redis) Info(section ...string) (string, error)
- func (r *Redis) Keys(pattern string) ([]string, error)
- func (r *Redis) Lastsave() (int64, error)
- func (r *Redis) Lindex(key string, index int64) (string, error)
- func (r *Redis) Linsert(key string, where ListOption, pivot, value string) (int64, error)
- func (r *Redis) Llen(key string) (int64, error)
- func (r *Redis) Lpop(key string) (string, error)
- func (r *Redis) Lpush(key string, strings ...string) (int64, error)
- func (r *Redis) Lpushx(key string, string ...string) (int64, error)
- func (r *Redis) Lrange(key string, start, stop int64) ([]string, error)
- func (r *Redis) Lrem(key string, count int64, value string) (int64, error)
- func (r *Redis) Lset(key string, index int64, value string) (string, error)
- func (r *Redis) Ltrim(key string, start, stop int64) (string, error)
- func (r *Redis) Mget(keys ...string) ([]string, error)
- func (r *Redis) Move(key string, dbIndex int) (int64, error)
- func (r *Redis) Mset(keysvalues ...string) (string, error)
- func (r *Redis) Msetnx(keysvalues ...string) (int64, error)
- func (r *Redis) Multi() (*transaction, error)
- func (r *Redis) ObjectEncoding(str string) (string, error)
- func (r *Redis) ObjectIdletime(str string) (int64, error)
- func (r *Redis) ObjectRefcount(str string) (int64, error)
- func (r *Redis) Persist(key string) (int64, error)
- func (r *Redis) Pexpire(key string, milliseconds int64) (int64, error)
- func (r *Redis) PexpireAt(key string, millisecondsTimestamp int64) (int64, error)
- func (r *Redis) Pfadd(key string, elements ...string) (int64, error)
- func (r *Redis) Pfcount(keys ...string) (int64, error)
- func (r *Redis) Pfmerge(destkey string, sourcekeys ...string) (string, error)
- func (r *Redis) Ping() (string, error)
- func (r *Redis) Pipelined() *pipeline
- func (r *Redis) Psetex(key string, milliseconds int64, value string) (string, error)
- func (r *Redis) Psubscribe(redisPubSub *RedisPubSub, patterns ...string) error
- func (r *Redis) Pttl(key string) (int64, error)
- func (r *Redis) Publish(channel, message string) (int64, error)
- func (r *Redis) PubsubChannels(pattern string) ([]string, error)
- func (r *Redis) Quit() (string, error)
- func (r *Redis) RandomKey() (string, error)
- func (r *Redis) Readonly() (string, error)
- func (r *Redis) Receive() (interface{}, error)
- func (r *Redis) Rename(oldkey, newkey string) (string, error)
- func (r *Redis) Renamenx(oldkey, newkey string) (int64, error)
- func (r *Redis) Rpop(key string) (string, error)
- func (r *Redis) Rpoplpush(srckey, dstkey string) (string, error)
- func (r *Redis) Rpush(key string, strings ...string) (int64, error)
- func (r *Redis) Rpushx(key string, string ...string) (int64, error)
- func (r *Redis) Sadd(key string, members ...string) (int64, error)
- func (r *Redis) Save() (string, error)
- func (r *Redis) Scan(cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *Redis) Scard(key string) (int64, error)
- func (r *Redis) ScriptExists(sha1 ...string) ([]bool, error)
- func (r *Redis) ScriptLoad(script string) (string, error)
- func (r *Redis) Sdiff(keys ...string) ([]string, error)
- func (r *Redis) Sdiffstore(dstkey string, keys ...string) (int64, error)
- func (r *Redis) Select(index int) (string, error)
- func (r *Redis) Send(command protocolCommand, args ...[]byte) error
- func (r *Redis) SendByStr(command string, args ...[]byte) error
- func (r *Redis) SentinelFailover(masterName string) (string, error)
- func (r *Redis) SentinelGetMasterAddrByName(masterName string) ([]string, error)
- func (r *Redis) SentinelMasters() ([]map[string]string, error)
- func (r *Redis) SentinelMonitor(masterName, ip string, port, quorum int) (string, error)
- func (r *Redis) SentinelRemove(masterName string) (string, error)
- func (r *Redis) SentinelReset(pattern string) (int64, error)
- func (r *Redis) SentinelSet(masterName string, parameterMap map[string]string) (string, error)
- func (r *Redis) SentinelSlaves(masterName string) ([]map[string]string, error)
- func (r *Redis) Set(key, value string) (string, error)
- func (r *Redis) SetWithParams(key, value, nxxx string) (string, error)
- func (r *Redis) SetWithParamsAndTime(key, value, nxxx, expx string, time int64) (string, error)
- func (r *Redis) Setbit(key string, offset int64, value string) (bool, error)
- func (r *Redis) SetbitWithBool(key string, offset int64, value bool) (bool, error)
- func (r *Redis) Setex(key string, seconds int, value string) (string, error)
- func (r *Redis) Setnx(key, value string) (int64, error)
- func (r *Redis) Setrange(key string, offset int64, value string) (int64, error)
- func (r *Redis) Shutdown() (string, error)
- func (r *Redis) Sinter(keys ...string) ([]string, error)
- func (r *Redis) Sinterstore(dstkey string, keys ...string) (int64, error)
- func (r *Redis) Sismember(key, member string) (bool, error)
- func (r *Redis) Slaveof(host string, port int) (string, error)
- func (r *Redis) SlaveofNoOne() (string, error)
- func (r *Redis) SlowlogGet(entries ...int64) ([]Slowlog, error)
- func (r *Redis) SlowlogLen() (int64, error)
- func (r *Redis) SlowlogReset() (string, error)
- func (r *Redis) Smembers(key string) ([]string, error)
- func (r *Redis) Smove(srckey, dstkey, member string) (int64, error)
- func (r *Redis) Sort(key string, sortingParameters ...SortingParams) ([]string, error)
- func (r *Redis) SortStore(key, dstkey string, sortingParameters ...SortingParams) (int64, error)
- func (r *Redis) Spop(key string) (string, error)
- func (r *Redis) SpopBatch(key string, count int64) ([]string, error)
- func (r *Redis) Srandmember(key string) (string, error)
- func (r *Redis) SrandmemberBatch(key string, count int) ([]string, error)
- func (r *Redis) Srem(key string, members ...string) (int64, error)
- func (r *Redis) Sscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *Redis) Strlen(key string) (int64, error)
- func (r *Redis) Subscribe(redisPubSub *RedisPubSub, channels ...string) error
- func (r *Redis) Substr(key string, start, end int) (string, error)
- func (r *Redis) Sunion(keys ...string) ([]string, error)
- func (r *Redis) Sunionstore(dstkey string, keys ...string) (int64, error)
- func (r *Redis) Ttl(key string) (int64, error)
- func (r *Redis) Type(key string) (string, error)
- func (r *Redis) Unwatch() (string, error)
- func (r *Redis) WaitReplicas(replicas int, timeout int64) (int64, error)
- func (r *Redis) Watch(keys ...string) (string, error)
- func (r *Redis) Zadd(key string, score float64, member string, mparams ...*ZAddParams) (int64, error)
- func (r *Redis) ZaddByMap(key string, scoreMembers map[string]float64, params ...*ZAddParams) (int64, error)
- func (r *Redis) Zcard(key string) (int64, error)
- func (r *Redis) Zcount(key, min, max string) (int64, error)
- func (r *Redis) Zincrby(key string, increment float64, member string, params ...*ZAddParams) (float64, error)
- func (r *Redis) Zinterstore(dstkey string, sets ...string) (int64, error)
- func (r *Redis) ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
- func (r *Redis) Zlexcount(key, min, max string) (int64, error)
- func (r *Redis) Zrange(key string, start, stop int64) ([]string, error)
- func (r *Redis) ZrangeByLex(key, min, max string) ([]string, error)
- func (r *Redis) ZrangeByLexBatch(key, min, max string, offset, count int) ([]string, error)
- func (r *Redis) ZrangeByScore(key, min, max string) ([]string, error)
- func (r *Redis) ZrangeByScoreBatch(key, min, max string, offset, count int) ([]string, error)
- func (r *Redis) ZrangeByScoreWithScores(key, min, max string) ([]Tuple, error)
- func (r *Redis) ZrangeByScoreWithScoresBatch(key, min, max string, offset, count int) ([]Tuple, error)
- func (r *Redis) ZrangeWithScores(key string, start, end int64) ([]Tuple, error)
- func (r *Redis) Zrank(key, member string) (int64, error)
- func (r *Redis) Zrem(key string, members ...string) (int64, error)
- func (r *Redis) ZremrangeByLex(key, min, max string) (int64, error)
- func (r *Redis) ZremrangeByRank(key string, start, stop int64) (int64, error)
- func (r *Redis) ZremrangeByScore(key, start, end string) (int64, error)
- func (r *Redis) Zrevrange(key string, start, stop int64) ([]string, error)
- func (r *Redis) ZrevrangeByLex(key, max, min string) ([]string, error)
- func (r *Redis) ZrevrangeByLexBatch(key, max, min string, offset, count int) ([]string, error)
- func (r *Redis) ZrevrangeByScore(key, max, min string) ([]string, error)
- func (r *Redis) ZrevrangeByScoreWithScores(key, max, min string) ([]Tuple, error)
- func (r *Redis) ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) ([]Tuple, error)
- func (r *Redis) ZrevrangeWithScores(key string, start, end int64) ([]Tuple, error)
- func (r *Redis) Zrevrank(key, member string) (int64, error)
- func (r *Redis) Zscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *Redis) Zscore(key, member string) (float64, error)
- func (r *Redis) Zunionstore(dstkey string, sets ...string) (int64, error)
- func (r *Redis) ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
- type RedisCluster
- func (r *RedisCluster) Append(key, value string) (int64, error)
- func (r *RedisCluster) Bitcount(key string) (int64, error)
- func (r *RedisCluster) BitcountRange(key string, start int64, end int64) (int64, error)
- func (r *RedisCluster) Bitfield(key string, arguments ...string) ([]int64, error)
- func (r *RedisCluster) Bitop(op BitOP, destKey string, srcKeys ...string) (int64, error)
- func (r *RedisCluster) Bitpos(key string, value bool, params ...BitPosParams) (int64, error)
- func (r *RedisCluster) Blpop(args ...string) ([]string, error)
- func (r *RedisCluster) BlpopTimout(timeout int, keys ...string) ([]string, error)
- func (r *RedisCluster) Brpop(args ...string) ([]string, error)
- func (r *RedisCluster) BrpopTimout(timeout int, keys ...string) ([]string, error)
- func (r *RedisCluster) Brpoplpush(source, destination string, timeout int) (string, error)
- func (r *RedisCluster) Decr(key string) (int64, error)
- func (r *RedisCluster) DecrBy(key string, decrement int64) (int64, error)
- func (r *RedisCluster) Del(keys ...string) (int64, error)
- func (r *RedisCluster) Echo(str string) (string, error)
- func (r *RedisCluster) Eval(script string, keyCount int, params ...string) (interface{}, error)
- func (r *RedisCluster) Evalsha(sha1 string, keyCount int, params ...string) (interface{}, error)
- func (r *RedisCluster) Exists(keys ...string) (int64, error)
- func (r *RedisCluster) Expire(key string, seconds int) (int64, error)
- func (r *RedisCluster) ExpireAt(key string, unixtime int64) (int64, error)
- func (r *RedisCluster) Geoadd(key string, longitude, latitude float64, member string) (int64, error)
- func (r *RedisCluster) GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (int64, error)
- func (r *RedisCluster) Geodist(key string, member1, member2 string, unit ...GeoUnit) (float64, error)
- func (r *RedisCluster) Geohash(key string, members ...string) ([]string, error)
- func (r *RedisCluster) Geopos(key string, members ...string) ([]*GeoCoordinate, error)
- func (r *RedisCluster) Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, ...) ([]GeoRadiusResponse, error)
- func (r *RedisCluster) GeoradiusByMember(key string, member string, radius float64, unit GeoUnit, ...) ([]GeoRadiusResponse, error)
- func (r *RedisCluster) Get(key string) (string, error)
- func (r *RedisCluster) GetSet(key, value string) (string, error)
- func (r *RedisCluster) Getbit(key string, offset int64) (bool, error)
- func (r *RedisCluster) Getrange(key string, startOffset, endOffset int64) (string, error)
- func (r *RedisCluster) Hdel(key string, fields ...string) (int64, error)
- func (r *RedisCluster) Hexists(key, field string) (bool, error)
- func (r *RedisCluster) Hget(key, field string) (string, error)
- func (r *RedisCluster) HgetAll(key string) (map[string]string, error)
- func (r *RedisCluster) HincrBy(key, field string, value int64) (int64, error)
- func (r *RedisCluster) HincrByFloat(key, field string, value float64) (float64, error)
- func (r *RedisCluster) Hkeys(key string) ([]string, error)
- func (r *RedisCluster) Hlen(key string) (int64, error)
- func (r *RedisCluster) Hmget(key string, fields ...string) ([]string, error)
- func (r *RedisCluster) Hmset(key string, hash map[string]string) (string, error)
- func (r *RedisCluster) Hscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *RedisCluster) Hset(key, field string, value string) (int64, error)
- func (r *RedisCluster) Hsetnx(key, field, value string) (int64, error)
- func (r *RedisCluster) Hvals(key string) ([]string, error)
- func (r *RedisCluster) Incr(key string) (int64, error)
- func (r *RedisCluster) IncrBy(key string, increment int64) (int64, error)
- func (r *RedisCluster) IncrByFloat(key string, increment float64) (float64, error)
- func (r *RedisCluster) Lindex(key string, index int64) (string, error)
- func (r *RedisCluster) Linsert(key string, where ListOption, pivot, value string) (int64, error)
- func (r *RedisCluster) Llen(key string) (int64, error)
- func (r *RedisCluster) Lpop(key string) (string, error)
- func (r *RedisCluster) Lpush(key string, strings ...string) (int64, error)
- func (r *RedisCluster) Lpushx(key string, strs ...string) (int64, error)
- func (r *RedisCluster) Lrange(key string, start, stop int64) ([]string, error)
- func (r *RedisCluster) Lrem(key string, count int64, value string) (int64, error)
- func (r *RedisCluster) Lset(key string, index int64, value string) (string, error)
- func (r *RedisCluster) Ltrim(key string, start, stop int64) (string, error)
- func (r *RedisCluster) Mget(keys ...string) ([]string, error)
- func (r *RedisCluster) Mset(keysvalues ...string) (string, error)
- func (r *RedisCluster) Msetnx(keysvalues ...string) (int64, error)
- func (r *RedisCluster) Persist(key string) (int64, error)
- func (r *RedisCluster) Pexpire(key string, milliseconds int64) (int64, error)
- func (r *RedisCluster) PexpireAt(key string, millisecondsTimestamp int64) (int64, error)
- func (r *RedisCluster) Pfadd(key string, elements ...string) (int64, error)
- func (r *RedisCluster) Pfcount(keys ...string) (int64, error)
- func (r *RedisCluster) Pfmerge(destkey string, sourcekeys ...string) (string, error)
- func (r *RedisCluster) Psetex(key string, milliseconds int64, value string) (string, error)
- func (r *RedisCluster) Psubscribe(redisPubSub *RedisPubSub, patterns ...string) error
- func (r *RedisCluster) Pttl(key string) (int64, error)
- func (r *RedisCluster) Publish(channel, message string) (int64, error)
- func (r *RedisCluster) Rename(oldkey, newkey string) (string, error)
- func (r *RedisCluster) Renamenx(oldkey, newkey string) (int64, error)
- func (r *RedisCluster) Rpop(key string) (string, error)
- func (r *RedisCluster) Rpoplpush(srckey, dstkey string) (string, error)
- func (r *RedisCluster) Rpush(key string, strings ...string) (int64, error)
- func (r *RedisCluster) Rpushx(key string, strs ...string) (int64, error)
- func (r *RedisCluster) Sadd(key string, members ...string) (int64, error)
- func (r *RedisCluster) Scan(cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *RedisCluster) Scard(key string) (int64, error)
- func (r *RedisCluster) ScriptExists(key string, sha1 ...string) ([]bool, error)
- func (r *RedisCluster) ScriptLoad(key, script string) (string, error)
- func (r *RedisCluster) Sdiff(keys ...string) ([]string, error)
- func (r *RedisCluster) Sdiffstore(dstkey string, keys ...string) (int64, error)
- func (r *RedisCluster) Set(key, value string) (string, error)
- func (r *RedisCluster) SetWithParams(key, value, nxxx string) (string, error)
- func (r *RedisCluster) SetWithParamsAndTime(key, value, nxxx, expx string, time int64) (string, error)
- func (r *RedisCluster) Setbit(key string, offset int64, value string) (bool, error)
- func (r *RedisCluster) SetbitWithBool(key string, offset int64, value bool) (bool, error)
- func (r *RedisCluster) Setex(key string, seconds int, value string) (string, error)
- func (r *RedisCluster) Setnx(key, value string) (int64, error)
- func (r *RedisCluster) Setrange(key string, offset int64, value string) (int64, error)
- func (r *RedisCluster) Sinter(keys ...string) ([]string, error)
- func (r *RedisCluster) Sinterstore(dstkey string, keys ...string) (int64, error)
- func (r *RedisCluster) Sismember(key string, member string) (bool, error)
- func (r *RedisCluster) Smembers(key string) ([]string, error)
- func (r *RedisCluster) Smove(srckey, dstkey, member string) (int64, error)
- func (r *RedisCluster) Sort(key string, sortingParameters ...SortingParams) ([]string, error)
- func (r *RedisCluster) SortStore(key, dstkey string, sortingParameters ...SortingParams) (int64, error)
- func (r *RedisCluster) Spop(key string) (string, error)
- func (r *RedisCluster) SpopBatch(key string, count int64) ([]string, error)
- func (r *RedisCluster) Srandmember(key string) (string, error)
- func (r *RedisCluster) SrandmemberBatch(key string, count int) ([]string, error)
- func (r *RedisCluster) Srem(key string, members ...string) (int64, error)
- func (r *RedisCluster) Sscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *RedisCluster) Strlen(key string) (int64, error)
- func (r *RedisCluster) Subscribe(redisPubSub *RedisPubSub, channels ...string) error
- func (r *RedisCluster) Substr(key string, start, end int) (string, error)
- func (r *RedisCluster) Sunion(keys ...string) ([]string, error)
- func (r *RedisCluster) Sunionstore(dstkey string, keys ...string) (int64, error)
- func (r *RedisCluster) Ttl(key string) (int64, error)
- func (r *RedisCluster) Type(key string) (string, error)
- func (r *RedisCluster) Zadd(key string, score float64, member string, params ...*ZAddParams) (int64, error)
- func (r *RedisCluster) ZaddByMap(key string, scoreMembers map[string]float64, params ...*ZAddParams) (int64, error)
- func (r *RedisCluster) Zcard(key string) (int64, error)
- func (r *RedisCluster) Zcount(key string, min string, max string) (int64, error)
- func (r *RedisCluster) Zincrby(key string, score float64, member string, params ...*ZAddParams) (float64, error)
- func (r *RedisCluster) Zinterstore(dstkey string, sets ...string) (int64, error)
- func (r *RedisCluster) ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
- func (r *RedisCluster) Zlexcount(key, min, max string) (int64, error)
- func (r *RedisCluster) Zrange(key string, start, end int64) ([]string, error)
- func (r *RedisCluster) ZrangeByLex(key, min, max string) ([]string, error)
- func (r *RedisCluster) ZrangeByLexBatch(key, min, max string, offset, count int) ([]string, error)
- func (r *RedisCluster) ZrangeByScore(key string, min string, max string) ([]string, error)
- func (r *RedisCluster) ZrangeByScoreBatch(key string, min string, max string, offset int, count int) ([]string, error)
- func (r *RedisCluster) ZrangeByScoreWithScores(key, min, max string) ([]Tuple, error)
- func (r *RedisCluster) ZrangeByScoreWithScoresBatch(key, min, max string, offset, count int) ([]Tuple, error)
- func (r *RedisCluster) ZrangeWithScores(key string, start, end int64) ([]Tuple, error)
- func (r *RedisCluster) Zrank(key, member string) (int64, error)
- func (r *RedisCluster) Zrem(key string, member ...string) (int64, error)
- func (r *RedisCluster) ZremrangeByLex(key, min, max string) (int64, error)
- func (r *RedisCluster) ZremrangeByRank(key string, start, end int64) (int64, error)
- func (r *RedisCluster) ZremrangeByScore(key, start, end string) (int64, error)
- func (r *RedisCluster) Zrevrange(key string, start, end int64) ([]string, error)
- func (r *RedisCluster) ZrevrangeByLex(key, max, min string) ([]string, error)
- func (r *RedisCluster) ZrevrangeByLexBatch(key, max, min string, offset, count int) ([]string, error)
- func (r *RedisCluster) ZrevrangeByScore(key string, max string, min string) ([]string, error)
- func (r *RedisCluster) ZrevrangeByScoreWithScores(key, max, min string) ([]Tuple, error)
- func (r *RedisCluster) ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) ([]Tuple, error)
- func (r *RedisCluster) ZrevrangeWithScores(key string, start, end int64) ([]Tuple, error)
- func (r *RedisCluster) Zrevrank(key, member string) (int64, error)
- func (r *RedisCluster) Zscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
- func (r *RedisCluster) Zscore(key, member string) (float64, error)
- func (r *RedisCluster) Zunionstore(dstkey string, sets ...string) (int64, error)
- func (r *RedisCluster) ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
- type RedisError
- type RedisPubSub
- type Reset
- type ScanParams
- type ScanResult
- type Slowlog
- type SortingParams
- func (p *SortingParams) Alpha() *SortingParams
- func (p *SortingParams) Asc() *SortingParams
- func (p *SortingParams) By(pattern string) *SortingParams
- func (p *SortingParams) Desc() *SortingParams
- func (p *SortingParams) Get(patterns ...string) *SortingParams
- func (p *SortingParams) GetParams() [][]byte
- func (p *SortingParams) Limit(start, count int) *SortingParams
- func (p *SortingParams) NoSort() *SortingParams
- type Tuple
- type ZAddParams
- type ZParams
Constants ¶
const ( AskPrefix = "ASK " MovedPrefix = "MOVED " ClusterdownPrefix = "CLUSTERDOWN " BusyPrefix = "BUSY " NoscriptPrefix = "NOSCRIPT " DefaultHost = "localhost" DefaultPort = 6379 DefaultSentinelPort = 26379 DefaultTimeout = 5 * time.Second DefaultDatabase = 2 * time.Second DollarByte = '$' AsteriskByte = '*' PlusByte = '+' MinusByte = '-' ColonByte = ':' SentinelMasters = "masters" SentinelGetMasterAddrByName = "get-master-addr-by-name" SentinelReset = "reset" SentinelSlaves = "slaves" SentinelFailover = "failover" SentinelMonitor = "monitor" SentinelRemove = "remove" SentinelSet = "set" ClusterNodes = "nodes" ClusterMeet = "meet" ClusterReset = "reset" ClusterAddslots = "addslots" ClusterDelslots = "delslots" ClusterInfo = "info" ClusterGetkeysinslot = "getkeysinslot" ClusterSetslot = "setslot" ClusterSetslotNode = "node" ClusterSetslotMigrating = "migrating" ClusterSetslotImporting = "importing" ClusterSetslotStable = "stable" ClusterForget = "forget" ClusterFlushslot = "flushslots" ClusterKeyslot = "keyslot" ClusterCountkeyinslot = "countkeysinslot" ClusterSaveconfig = "saveconfig" ClusterReplicate = "replicate" ClusterSlaves = "slaves" ClusterFailover = "failover" ClusterSlots = "slots" PubsubChannels = "channels" PubsubNumsub = "numsub" PubsubNumPat = "numpat" )
const ( MaxUint = ^uint(0) MinUint = 0 MaxInt = int(MaxUint >> 1) MinInt = -MaxInt - 1 )
const (
MasterNodeIndex = 2
)
Variables ¶
var ( ListoptionBefore = newListOption("BEFORE") ListoptionAfter = newListOption("AFTER") )
var ( GeounitMi = newGeoUnit("mi") GeounitM = newGeoUnit("m") GeounitKm = newGeoUnit("km") GeounitFt = newGeoUnit("ft") )
var ( ZparamsSum = NewZParams("SUM") ZparamsMin = NewZParams("MIN") ZparamsMax = NewZParams("MAX") )
var ( BitopAnd = NewBitOP("AND") BitopOr = NewBitOP("OR") BitopXor = NewBitOP("XOR") BitopNot = NewBitOP("NOT") )
var ( ResetSoft = NewReset("SOFT") ResetHard = NewReset("HARD") )
var ( StringBuilder = newStringBuilder() //convert interface to string Int64Builder = newInt64Builder() //convert interface to int64 StringArrayBuilder = newStringArrayBuilder() //convert interface to string array )
var ( BytesTrue = IntToByteArray(1) BytesFalse = IntToByteArray(0) BytesTilde = []byte("~") PositiveInfinityBytes = []byte("+inf") NegativeInfinityBytes = []byte("-inf") )
var ( DigitTens = []byte{'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', '3', '3', '3', '3', '3', '3', '3', '3', '3', '3', '4', '4', '4', '4', '4', '4', '4', '4', '4', '4', '5', '5', '5', '5', '5', '5', '5', '5', '5', '5', '6', '6', '6', '6', '6', '6', '6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7', '7', '7', '8', '8', '8', '8', '8', '8', '8', '8', '8', '8', '9', '9', '9', '9', '9', '9', '9', '9', '9', '9'} DigitOnes = []byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} )
var ( CmdPing = newProtocolCommand("PING") CmdSet = newProtocolCommand("SET") CmdGet = newProtocolCommand("GET") CmdQuit = newProtocolCommand("QUIT") CmdExists = newProtocolCommand("EXISTS") CmdDel = newProtocolCommand("DEL") CmdUnlink = newProtocolCommand("UNLINK") CmdType = newProtocolCommand("TYPE") CmdFlushdb = newProtocolCommand("FLUSHDB") CmdKeys = newProtocolCommand("KEYS") CmdRandomkey = newProtocolCommand("RANDOMKEY") CmdRename = newProtocolCommand("RENAME") CmdRenamenx = newProtocolCommand("RENAMENX") CmdRenamex = newProtocolCommand("RENAMEX") CmdDbsize = newProtocolCommand("DBSIZE") CmdExpire = newProtocolCommand("EXPIRE") CmdExpireat = newProtocolCommand("EXPIREAT") CmdTtl = newProtocolCommand("TTL") CmdSelect = newProtocolCommand("SELECT") CmdMove = newProtocolCommand("MOVE") CmdFlushall = newProtocolCommand("FLUSHALL") CmdGetset = newProtocolCommand("GETSET") CmdMget = newProtocolCommand("MGET") CmdSetnx = newProtocolCommand("SETNX") CmdSetex = newProtocolCommand("SETEX") CmdMset = newProtocolCommand("MSET") CmdMsetnx = newProtocolCommand("MSETNX") CmdDecrby = newProtocolCommand("DECRBY") CmdDecr = newProtocolCommand("DECR") CmdIncrby = newProtocolCommand("INCRBY") CmdIncr = newProtocolCommand("INCR") CmdAppend = newProtocolCommand("APPEND") CmdSubstr = newProtocolCommand("SUBSTR") CmdHset = newProtocolCommand("HSET") CmdHget = newProtocolCommand("HGET") CmdHsetnx = newProtocolCommand("HSETNX") CmdHmset = newProtocolCommand("HMSET") CmdHmget = newProtocolCommand("HMGET") CmdHincrby = newProtocolCommand("HINCRBY") CmdHexists = newProtocolCommand("HEXISTS") CmdHdel = newProtocolCommand("HDEL") CmdHlen = newProtocolCommand("HLEN") CmdHkeys = newProtocolCommand("HKEYS") CmdHvals = newProtocolCommand("HVALS") CmdHgetall = newProtocolCommand("HGETALL") CmdRpush = newProtocolCommand("RPUSH") CmdLpush = newProtocolCommand("LPUSH") CmdLlen = newProtocolCommand("LLEN") CmdLrange = newProtocolCommand("LRANGE") CmdLtrim = newProtocolCommand("LTRIM") CmdLindex = newProtocolCommand("LINDEX") CmdLset = newProtocolCommand("LSET") CmdLrem = newProtocolCommand("LREM") CmdLpop = newProtocolCommand("LPOP") CmdRpop = newProtocolCommand("RPOP") CmdRpoplpush = newProtocolCommand("RPOPLPUSH") CmdSadd = newProtocolCommand("SADD") CmdSmembers = newProtocolCommand("SMEMBERS") CmdSrem = newProtocolCommand("SREM") CmdSpop = newProtocolCommand("SPOP") CmdSmove = newProtocolCommand("SMOVE") CmdScard = newProtocolCommand("SCARD") CmdSismember = newProtocolCommand("SISMEMBER") CmdSinter = newProtocolCommand("SINTER") CmdSinterstore = newProtocolCommand("SINTERSTORE") CmdSunion = newProtocolCommand("SUNION") CmdSunionstore = newProtocolCommand("SUNIONSTORE") CmdSdiff = newProtocolCommand("SDIFF") CmdSdiffstore = newProtocolCommand("SDIFFSTORE") CmdSrandmember = newProtocolCommand("SRANDMEMBER") CmdZadd = newProtocolCommand("ZADD") CmdZrange = newProtocolCommand("ZRANGE") CmdZrem = newProtocolCommand("ZREM") CmdZincrby = newProtocolCommand("ZINCRBY") CmdZrank = newProtocolCommand("ZRANK") CmdZrevrank = newProtocolCommand("ZREVRANK") CmdZrevrange = newProtocolCommand("ZREVRANGE") CmdZcard = newProtocolCommand("ZCARD") CmdZscore = newProtocolCommand("ZSCORE") CmdMulti = newProtocolCommand("MULTI") CmdDiscard = newProtocolCommand("DISCARD") CmdExec = newProtocolCommand("EXEC") CmdWatch = newProtocolCommand("WATCH") CmdUnwatch = newProtocolCommand("UNWATCH") CmdSort = newProtocolCommand("SORT") CmdBlpop = newProtocolCommand("BLPOP") CmdBrpop = newProtocolCommand("BRPOP") CmdAuth = newProtocolCommand("AUTH") CmdSubscribe = newProtocolCommand("SUBSCRIBE") CmdPublish = newProtocolCommand("PUBLISH") CmdUnsubscribe = newProtocolCommand("UNSUBSCRIBE") CmdPsubscribe = newProtocolCommand("PSUBSCRIBE") CmdPunsubscribe = newProtocolCommand("PUNSUBSCRIBE") CmdPubsub = newProtocolCommand("PUBSUB") CmdZcount = newProtocolCommand("ZCOUNT") CmdZrangebyscore = newProtocolCommand("ZRANGEBYSCORE") CmdZrevrangebyscore = newProtocolCommand("ZREVRANGEBYSCORE") CmdZremrangebyrank = newProtocolCommand("ZREMRANGEBYRANK") CmdZremrangebyscore = newProtocolCommand("ZREMRANGEBYSCORE") CmdZunionstore = newProtocolCommand("ZUNIONSTORE") CmdZinterstore = newProtocolCommand("ZINTERSTORE") CmdZlexcount = newProtocolCommand("ZLEXCOUNT") CmdZrangebylex = newProtocolCommand("ZRANGEBYLEX") CmdZrevrangebylex = newProtocolCommand("ZREVRANGEBYLEX") CmdZremrangebylex = newProtocolCommand("ZREMRANGEBYLEX") CmdSave = newProtocolCommand("SAVE") CmdBgsave = newProtocolCommand("BGSAVE") CmdBgrewriteaof = newProtocolCommand("BGREWRITEAOF") CmdLastsave = newProtocolCommand("LASTSAVE") CmdShutdown = newProtocolCommand("SHUTDOWN") CmdInfo = newProtocolCommand("INFO") CmdMonitor = newProtocolCommand("MONITOR") CmdSlaveof = newProtocolCommand("SLAVEOF") CmdConfig = newProtocolCommand("CONFIG") CmdStrlen = newProtocolCommand("STRLEN") CmdSync = newProtocolCommand("SYNC") CmdLpushx = newProtocolCommand("LPUSHX") CmdPersist = newProtocolCommand("PERSIST") CmdRpushx = newProtocolCommand("RPUSHX") CmdEcho = newProtocolCommand("ECHO") CmdLinsert = newProtocolCommand("LINSERT") CmdDebug = newProtocolCommand("DEBUG") CmdBrpoplpush = newProtocolCommand("BRPOPLPUSH") CmdSetbit = newProtocolCommand("SETBIT") CmdGetbit = newProtocolCommand("GETBIT") CmdBitpos = newProtocolCommand("BITPOS") CmdSetrange = newProtocolCommand("SETRANGE") CmdGetrange = newProtocolCommand("GETRANGE") CmdEval = newProtocolCommand("EVAL") CmdEvalsha = newProtocolCommand("EVALSHA") CmdScript = newProtocolCommand("SCRIPT") CmdSlowlog = newProtocolCommand("SLOWLOG") CmdObject = newProtocolCommand("OBJECT") CmdBitcount = newProtocolCommand("BITCOUNT") CmdBitop = newProtocolCommand("BITOP") CmdSentinel = newProtocolCommand("SENTINEL") CmdDump = newProtocolCommand("DUMP") CmdRestore = newProtocolCommand("RESTORE") CmdPexpire = newProtocolCommand("PEXPIRE") CmdPexpireat = newProtocolCommand("PEXPIREAT") CmdPttl = newProtocolCommand("PTTL") CmdIncrbyfloat = newProtocolCommand("INCRBYFLOAT") CmdPsetex = newProtocolCommand("PSETEX") CmdClient = newProtocolCommand("CLIENT") CmdTime = newProtocolCommand("TIME") CmdMigrate = newProtocolCommand("MIGRATE") CmdHincrbyfloat = newProtocolCommand("HINCRBYFLOAT") CmdScan = newProtocolCommand("SCAN") CmdHscan = newProtocolCommand("HSCAN") CmdSscan = newProtocolCommand("SSCAN") CmdZscan = newProtocolCommand("ZSCAN") CmdWait = newProtocolCommand("WAIT") CmdCluster = newProtocolCommand("CLUSTER") CmdAsking = newProtocolCommand("ASKING") CmdPfadd = newProtocolCommand("PFADD") CmdPfcount = newProtocolCommand("PFCOUNT") CmdPfmerge = newProtocolCommand("PFMERGE") CmdReadonly = newProtocolCommand("READONLY") CmdGeoadd = newProtocolCommand("GEOADD") CmdGeodist = newProtocolCommand("GEODIST") CmdGeohash = newProtocolCommand("GEOHASH") CmdGeopos = newProtocolCommand("GEOPOS") CmdGeoradius = newProtocolCommand("GEORADIUS") CmdGeoradiusRo = newProtocolCommand("GEORADIUS_RO") CmdGeoradiusbymember = newProtocolCommand("GEORADIUSBYMEMBER") CmdGeoradiusbymemberRo = newProtocolCommand("GEORADIUSBYMEMBER_RO") CmdModule = newProtocolCommand("MODULE") CmdBitfield = newProtocolCommand("BITFIELD") CmdHstrlen = newProtocolCommand("HSTRLEN") CmdTouch = newProtocolCommand("TOUCH") CmdSwapdb = newProtocolCommand("SWAPDB") CmdMemory = newProtocolCommand("MEMORY") CmdXadd = newProtocolCommand("XADD") CmdXlen = newProtocolCommand("XLEN") CmdXdel = newProtocolCommand("XDEL") CmdXtrim = newProtocolCommand("XTRIM") CmdXrange = newProtocolCommand("XRANGE") CmdXrevrange = newProtocolCommand("XREVRANGE") CmdXread = newProtocolCommand("XREAD") CmdXack = newProtocolCommand("XACK") CmdXgroup = newProtocolCommand("XGROUP") CmdXreadgroup = newProtocolCommand("XREADGROUP") CmdXpending = newProtocolCommand("XPENDING") CmdXclaim = newProtocolCommand("XCLAIM") )
var ( KeywordAggregate = newKeyword("AGGREGATE") KeywordAlpha = newKeyword("ALPHA") KeywordAsc = newKeyword("ASC") KeywordBy = newKeyword("BY") KeywordDesc = newKeyword("DESC") KeywordGet = newKeyword("GET") KeywordLimit = newKeyword("LIMIT") KeywordMessage = newKeyword("MESSAGE") KeywordNo = newKeyword("NO") KeywordNosort = newKeyword("NOSORT") KeywordPmessage = newKeyword("PMESSAGE") KeywordPsubscribe = newKeyword("PSUBSCRIBE") KeywordPunsubscribe = newKeyword("PUNSUBSCRIBE") KeywordOk = newKeyword("OK") KeywordOne = newKeyword("ONE") KeywordQueued = newKeyword("QUEUED") KeywordSet = newKeyword("SET") KeywordStore = newKeyword("STORE") KeywordSubscribe = newKeyword("SUBSCRIBE") KeywordUnsubscribe = newKeyword("UNSUBSCRIBE") KeywordWeights = newKeyword("WEIGHTS") KeywordWithscores = newKeyword("WITHSCORES") KeywordResetstat = newKeyword("RESETSTAT") KeywordRewrite = newKeyword("REWRITE") KeywordReset = newKeyword("RESET") KeywordFlush = newKeyword("FLUSH") KeywordExists = newKeyword("EXISTS") KeywordLoad = newKeyword("LOAD") KeywordKill = newKeyword("KILL") KeywordLen = newKeyword("LEN") KeywordRefcount = newKeyword("REFCOUNT") KeywordEncoding = newKeyword("ENCODING") KeywordIdletime = newKeyword("IDLETIME") KeywordGetname = newKeyword("GETNAME") KeywordSetname = newKeyword("SETNAME") KeywordList = newKeyword("LIST") KeywordMatch = newKeyword("MATCH") KeywordCount = newKeyword("COUNT") KeywordPing = newKeyword("PING") KeywordPong = newKeyword("PONG") KeywordUnload = newKeyword("UNLOAD") KeywordReplace = newKeyword("REPLACE") KeywordKeys = newKeyword("KEYS") KeywordPause = newKeyword("PAUSE") KeywordDoctor = newKeyword("DOCTOR") KeywordBlock = newKeyword("BLOCK") KeywordNoack = newKeyword("NOACK") KeywordStreams = newKeyword("STREAMS") KeywordKey = newKeyword("KEY") KeywordCreate = newKeyword("CREATE") KeywordMkstream = newKeyword("MKSTREAM") KeywordSetid = newKeyword("SETID") KeywordDestroy = newKeyword("DESTROY") KeywordDelconsumer = newKeyword("DELCONSUMER") KeywordMaxlen = newKeyword("MAXLEN") KeywordGroup = newKeyword("GROUP") KeywordIdle = newKeyword("IDLE") KeywordTime = newKeyword("TIME") KeywordRetrycount = newKeyword("RETRYCOUNT") KeywordForce = newKeyword("FORCE") )
var (
ErrClosed = errors.New("pool is closed")
)
var LockTimeoutErr = errors.New("get lock timeout")
Functions ¶
func BoolToByteArray ¶
BoolToByteArray convert bool to byte array
func ByteArrToStringReply ¶ added in v0.0.7
ByteToStringReply convert byte array reply to string reply
func ByteArrayToFloat64 ¶
ByteArrayToFloat64 convert byte array to float64
func ByteArrayToInt64 ¶ added in v0.0.3
ByteArrayToInt64 convert byte array to int64
func Float64ToByteArray ¶
Float64ToByteArray convert float64 to byte array
func Int64ToBoolReply ¶
Int64ToBoolReply convert int64 reply to bool reply
func Int64ToByteArray ¶
Int64ToByteArray convert int64 to byte array
func NewClusterLocker ¶ added in v0.0.6
func NewClusterLocker(option *ClusterOption, lockOption *LockOption) *clusterLocker
create new cluster locker
func NewLocker ¶ added in v0.0.6
func NewLocker(option *Option, lockOption *LockOption) *locker
create new locker
func ObjectArrToMapArrayReply ¶
ObjectArrToMapArrayReply convert object array reply to map array reply
func ObjectToEvalResult ¶
ObjectToEvalResult resolve response data when use script command
func StringArrayToByteArray ¶
StringArrayToByteArray convert string array to byte array list
func StringArrayToMapReply ¶
StringArrayToMapReply convert string array reply to map reply
func StringStringArrayToByteArray ¶
StringStringArrayToByteArray convert string and string array to byte array
func StringStringArrayToStringArray ¶
StringStringArrayToStringArray convert string and string array to string array
func StringToFloat64Reply ¶
StringToFloat64Reply convert string reply to float64 reply
func ToBoolArrayReply ¶
ToBoolArrayReply convert object reply to bool array reply
func ToBoolReply ¶
ToBoolReply convert object reply to bool reply
func ToFloat64Reply ¶
ToFloat64Reply convert object reply to float64 reply
func ToInt64ArrayReply ¶
ToInt64ArrayReply convert object reply to int64 array reply
func ToInt64Reply ¶
ToInt64Reply convert object reply to int64 reply
func ToMapReply ¶
ToMapReply convert object reply to map reply
func ToStringArrayReply ¶
ToStringArrayReply convert object reply to string array reply
func ToStringReply ¶
ToStringReply convert object reply to string reply
Types ¶
type AskDataError ¶ added in v0.0.5
ask data error
func (*AskDataError) Error ¶ added in v0.0.5
func (e *AskDataError) Error() string
type BitPosParams ¶
type BitPosParams struct {
// contains filtered or unexported fields
}
BitPosParams
type Builder ¶
type Builder interface {
// contains filtered or unexported methods
}
Builder convert pipeline|transaction response data
type ClusterError ¶ added in v0.0.5
type ClusterError struct {
Message string
}
cluster basic error
func (*ClusterError) Error ¶ added in v0.0.5
func (e *ClusterError) Error() string
type ClusterMaxAttemptsError ¶ added in v0.0.7
type ClusterMaxAttemptsError struct {
Message string
}
cluster operation exceed max attempts errror
func (*ClusterMaxAttemptsError) Error ¶ added in v0.0.7
func (e *ClusterMaxAttemptsError) Error() string
type ClusterOperationError ¶ added in v0.0.7
type ClusterOperationError struct {
Message string
}
cluster operation error
func (*ClusterOperationError) Error ¶ added in v0.0.7
func (e *ClusterOperationError) Error() string
type ClusterOption ¶ added in v0.0.6
type ConnectError ¶ added in v0.0.5
type ConnectError struct {
Message string
}
redis connection error,such as io timeout
func (*ConnectError) Error ¶ added in v0.0.5
func (e *ConnectError) Error() string
type DebugParams ¶
type DebugParams struct {
// contains filtered or unexported fields
}
DebugParams ...
func NewDebugParamsObject ¶ added in v0.0.5
func NewDebugParamsObject(key string) *DebugParams
func NewDebugParamsReload ¶ added in v0.0.5
func NewDebugParamsReload() *DebugParams
func NewDebugParamsSegfault ¶ added in v0.0.5
func NewDebugParamsSegfault() *DebugParams
type GeoCoordinate ¶
type GeoCoordinate struct {
// contains filtered or unexported fields
}
GeoCoordinate ...
func ObjectArrToGeoCoordinateReply ¶
func ObjectArrToGeoCoordinateReply(reply []interface{}, err error) ([]*GeoCoordinate, error)
ObjectArrToGeoCoordinateReply convert object array reply to GeoCoordinate reply
func ToGeoArrayReply ¶
func ToGeoArrayReply(reply interface{}, err error) ([]*GeoCoordinate, error)
ToGeoArrayReply convert object reply to geocoordinate array reply
type GeoRadiusParam ¶
type GeoRadiusParam struct {
// contains filtered or unexported fields
}
GeoRadiusParam
func NewGeoRadiusParam ¶ added in v0.0.7
func NewGeoRadiusParam() *GeoRadiusParam
NewGeoRadiusParam constructor
func (GeoRadiusParam) Contains ¶ added in v0.0.3
func (g GeoRadiusParam) Contains(key string) bool
Contains ...
func (*GeoRadiusParam) Count ¶ added in v0.0.7
func (p *GeoRadiusParam) Count(count int) *GeoRadiusParam
func (GeoRadiusParam) GetParams ¶ added in v0.0.3
func (g GeoRadiusParam) GetParams(args [][]byte) [][]byte
GetParams ...
func (*GeoRadiusParam) SortAscending ¶ added in v0.0.7
func (p *GeoRadiusParam) SortAscending() *GeoRadiusParam
func (*GeoRadiusParam) SortDescending ¶ added in v0.0.7
func (p *GeoRadiusParam) SortDescending() *GeoRadiusParam
func (*GeoRadiusParam) WithCoord ¶ added in v0.0.7
func (p *GeoRadiusParam) WithCoord() *GeoRadiusParam
func (*GeoRadiusParam) WithDist ¶ added in v0.0.7
func (p *GeoRadiusParam) WithDist() *GeoRadiusParam
type GeoRadiusResponse ¶
type GeoRadiusResponse struct {
// contains filtered or unexported fields
}
GeoRadiusResponse ...
func ObjectArrToGeoRadiusResponseReply ¶ added in v0.0.7
func ObjectArrToGeoRadiusResponseReply(reply []interface{}, err error) ([]GeoRadiusResponse, error)
ObjectArrToGeoRadiusResponseReply convert object array reply to GeoRadiusResponse reply
func ToGeoRespArrayReply ¶ added in v0.0.7
func ToGeoRespArrayReply(reply interface{}, err error) ([]GeoRadiusResponse, error)
ToGeoRespArrayReply convert object reply to GeoRadiusResponse array reply
type LockOption ¶ added in v0.0.5
locker options
type MovedDataError ¶ added in v0.0.5
cluster move data error
func (*MovedDataError) Error ¶ added in v0.0.5
func (e *MovedDataError) Error() string
type NoReachableClusterNodeError ¶ added in v0.0.6
type NoReachableClusterNodeError struct {
Message string
}
have no reachable cluster node error
func (*NoReachableClusterNodeError) Error ¶ added in v0.0.6
func (e *NoReachableClusterNodeError) Error() string
type NoScriptError ¶ added in v0.0.5
type NoScriptError struct {
Message string
}
has no script error
func (*NoScriptError) Error ¶ added in v0.0.5
func (e *NoScriptError) Error() string
type Option ¶ added in v0.0.3
type Option struct { Host string // redis host Port int // redis port ConnectionTimeout time.Duration // connect timeout SoTimeout time.Duration // read timeout Password string // redis password,if empty,then without auth Db int // which db to connect }
Option connect options
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool redis pool
func (*Pool) GetResource ¶
GetResource get redis instance from pool
type PoolConfig ¶
type PoolConfig struct { MaxTotal int MaxIdle int MinIdle int MinEvictableIdleTime time.Duration TestOnBorrow bool }
PoolConfig redis pool config
type RedirectError ¶ added in v0.0.7
type RedirectError struct {
Message string
}
cluster operation redirect error
func (*RedirectError) Error ¶ added in v0.0.7
func (e *RedirectError) Error() string
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis redis client tool
func (*Redis) Append ¶
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.
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.
return Integer reply, specifically the total length of the string after the append operation.
func (*Redis) Bitcount ¶
Count the number of set bits (population counting) in a string.
By default all the bytes contained in the string are examined. It is possible to specify the counting operation only in an interval passing the additional arguments start and end.
Like for the GETRANGE command start and end can contain negative values in order to index bytes starting from the end of the string, where -1 is the last byte, -2 is the penultimate, and so forth.
Non-existent keys are treated as empty strings, so the command will return zero.
Return value Integer reply The number of bits set to 1.
func (*Redis) BitcountRange ¶
see Bitcount()
func (*Redis) Bitfield ¶
Bitfield The command treats a Redis string as a array of bits, and is capable of addressing specific integer fields of varying bit widths and arbitrary non (necessary) aligned offset.
func (*Redis) Blpop ¶
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.
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).
<b>Non blocking behavior</b>
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).
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).
<b>Blocking behavior</b>
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.
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.
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.
The timeout argument is interpreted as an integer value. A timeout of zero means instead to block forever.
<b>Multiple clients blocking for the same keys</b>
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.
<b>blocking POP inside a MULTI/EXEC transaction</b>
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).
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 :)
return BLPOP returns a two-elements array via a multi bulk reply in order to return both the
unblocking key and the popped value. 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 ¶
BlpopTimout ...
func (*Redis) BrpopTimout ¶
BrpopTimout ...
func (*Redis) Brpoplpush ¶
Brpoplpush ...
func (*Redis) ClusterAddSlots ¶
ClusterAddSlots ...
func (*Redis) ClusterCountKeysInSlot ¶
ClusterCountKeysInSlot ...
func (*Redis) ClusterDelSlots ¶
ClusterDelSlots ...
func (*Redis) ClusterFailover ¶
ClusterFailover This command, that can only be sent to a Redis Cluster replica node, forces the replica to start a manual failover of its master instance.
func (*Redis) ClusterFlushSlots ¶
ClusterFlushSlots ...
func (*Redis) ClusterForget ¶
ClusterForget ...
func (*Redis) ClusterGetKeysInSlot ¶
ClusterGetKeysInSlot ...
func (*Redis) ClusterKeySlot ¶
ClusterKeySlot ...
func (*Redis) ClusterMeet ¶
ClusterMeet ...
func (*Redis) ClusterNodes ¶
ClusterNodes Each node in a Redis Cluster has its view of the current cluster configuration, given by the set of known nodes, the state of the connection we have with such nodes, their flags, properties and assigned slots, and so forth.
func (*Redis) ClusterReplicate ¶
ClusterReplicate ...
func (*Redis) ClusterReset ¶
ClusterReset ...
func (*Redis) ClusterSaveConfig ¶
ClusterSaveConfig ...
func (*Redis) ClusterSetSlotImporting ¶
ClusterSetSlotImporting ...
func (*Redis) ClusterSetSlotMigrating ¶
ClusterSetSlotMigrating ...
func (*Redis) ClusterSetSlotNode ¶
ClusterSetSlotNode ...
func (*Redis) ClusterSetSlotStable ¶
ClusterSetSlotStable ...
func (*Redis) ClusterSlaves ¶
ClusterSlaves ...
func (*Redis) ConfigResetStat ¶
ConfigResetStat ...
func (*Redis) Decr ¶
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.
INCR commands are limited to 64 bit signed integers.
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.
return Integer reply, this commands will reply with the new value of key after the increment.
func (*Redis) DecrBy ¶
IDECRBY work just like {@link #decr(String) INCR} but instead to decrement by 1 the decrement is integer.
INCR commands are limited to 64 bit signed integers.
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.
return Integer reply, this commands will reply with the new value of key after the increment.
func (*Redis) Del ¶
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. 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) EvalByKeyArgs ¶ added in v0.0.5
EvalByKeyArgs evaluate scripts using the Lua interpreter built into Redis
func (*Redis) Evalsha ¶
Evalsha Evaluates a script cached on the server side by its SHA1 digest. Scripts are cached on the server side using the SCRIPT LOAD command. The command is otherwise identical to EVAL.
func (*Redis) Exists ¶
Test if the specified key exists. The command returns the number of keys existed 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 ¶
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.
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.
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.
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 < 2.1.3, Redis >= 2.1.3 will happily update the timeout), or the key does not exist.
func (*Redis) ExpireAt ¶
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 specifying the TTL), it takes an absolute one in the form of a UNIX timestamp (Number of seconds elapsed since 1 Gen 1970).
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.
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.
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 < 2.1.3, Redis >= 2.1.3 will happily update the timeout), or the key does not exist.
func (*Redis) GeoaddByMap ¶
func (r *Redis) GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (int64, error)
GeoaddByMap add geo point by map Return value Integer reply, specifically: The number of elements added to the sorted set, not including elements already existing for which the score was updated.
func (*Redis) Geopos ¶
func (r *Redis) Geopos(key string, members ...string) ([]*GeoCoordinate, error)
Geopos get geo points
func (*Redis) Georadius ¶
func (r *Redis) Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, param ...*GeoRadiusParam) ([]GeoRadiusResponse, error)
Georadius get members in certain rage
func (*Redis) GeoradiusByMember ¶
func (r *Redis) GeoradiusByMember(key, member string, radius float64, unit GeoUnit, param ...*GeoRadiusParam) ([]GeoRadiusResponse, error)
GeoradiusByMember ...
func (*Redis) Get ¶
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. param key return Bulk reply
func (*Redis) GetSet ¶
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).
return Bulk reply
func (*Redis) Getbit ¶
Returns the bit value at offset in the string value stored at key.
When offset is beyond the string length, the string is assumed to be a contiguous space with 0 bits. When key does not exist it is assumed to be an empty string, so offset is always out of range and the value is also assumed to be a contiguous space with 0 bits.
Return value Integer reply: the bit value stored at offset.
func (*Redis) Getrange ¶
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 ¶
Remove the specified field from an hash stored at key.
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 ¶
Test for existence of a specified field in a hash.
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 ¶
If key holds a hash, retrieve the value associated to the specified field.
If the field is not found or the key does not exist, a special 'nil' value is returned.
return Bulk reply
func (*Redis) HgetAll ¶
Return all the fields and associated values in a hash.
return All the fields and values contained into a hash.
func (*Redis) HincrBy ¶
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.
The range of values supported by HINCRBY is limited to 64 bit signed integers.
return Integer reply The new value at field after the increment operation.
func (*Redis) HincrByFloat ¶
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.
The range of values supported by HINCRBYFLOAT is limited to double precision floating point values.
return Double precision floating point reply The new value at field after the increment
operation.
func (*Redis) Hkeys ¶
Return all the fields in a hash.
return All the fields names contained into a hash.
func (*Redis) Hlen ¶
Return the number of items in a hash.
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 ¶
Retrieve the values associated to the specified fields.
If some of the specified fields do not exist, nil values are returned. Non existing keys are considered like empty hashes.
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 ¶
Set the respective fields to the respective values. HMSET replaces old values with new values.
If key does not exist, a new key holding a hash is created.
return Return OK or Exception if hash is empty
func (*Redis) Hscan ¶
func (r *Redis) Hscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
Hscan scan keys of hash , see scan
func (*Redis) Hset ¶
Set the specified hash field to the specified value.
If key does not exist, a new key holding a hash is created.
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 ¶
Set the specified hash field to the specified value if the field not exists.
return If the field already exists, 0 is returned, otherwise if a new field is created 1 is returned.
func (*Redis) Hvals ¶
Return all the values in a hash.
return All the fields values contained into a hash.
func (*Redis) Incr ¶
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.
INCR commands are limited to 64 bit signed integers.
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.
return Integer reply, this commands will reply with the new value of key after the increment.
func (*Redis) IncrBy ¶
INCRBY work just like {@link #incr(String) INCR} but instead to increment by 1 the increment is integer.
INCR commands are limited to 64 bit signed integers.
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.
return Integer reply, this commands will reply with the new value of key after the increment.
func (*Redis) IncrByFloat ¶
INCRBYFLOAT commands are limited to double precision floating point values.
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.
return Double reply, this commands will reply with the new value of key after the increment.
func (*Redis) Keys ¶
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".
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>
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.
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>
Use \ to escape special chars if you want to match them verbatim.
return Multi bulk reply
func (*Redis) Lindex ¶
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.
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.
return Bulk reply, specifically the requested element
func (*Redis) Linsert ¶
Inserts value in the list stored at key either before or after the reference value pivot. When key does not exist, it is considered an empty list and no operation is performed. An error is returned when key exists but does not hold a list value.
Return value Integer reply: the length of the list after the insert operation, or -1 when the value pivot was not found.
func (*Redis) Llen ¶
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.
return The length of the list.
func (*Redis) Lpop ¶
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".
If the key does not exist or the list is already empty the special value 'nil' is returned.
return Bulk reply
func (*Redis) Lpush ¶
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.
return Integer reply, specifically, the number of elements inside the list after the push
operation.
func (*Redis) Lpushx ¶
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 ¶
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.
For example LRANGE foobar 0 2 will return the first three elements of the list.
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.
<b>Consistency with range functions in various programming languages</b>
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).
LRANGE behavior is consistent with one of Tcl.
Indexes out of range will not produce an error: if start is over the end of the list, or start > 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.
return Multi bulk reply, specifically a list of elements in the specified range.
func (*Redis) Lrem ¶
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.
return Integer Reply, specifically: The number of removed elements if the operation succeeded
func (*Redis) Lset ¶
Set a new value as the element at index position of the List at key.
Out of range indexes will generate an error.
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.
return Status code reply
func (*Redis) Ltrim ¶
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.
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.
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.
Indexes out of range will not produce an error: if start is over the end of the list, or start > 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.
Hint: the obvious use of LTRIM is together with LPUSH/RPUSH. For example:
{@code lpush("mylist", "someelement"); ltrim("mylist", 0, 99); //}
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.
return Status code reply
func (*Redis) Mget ¶
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.
return Multi bulk reply
func (*Redis) Move ¶
Move key from the currently selected database (see SELECT) to the specified destination database. When key already exists in the destination database, or it does not exist in the source database, it does nothing. It is possible to use MOVE as a locking primitive because of this.
Return value Integer reply, specifically:
1 if key was moved. 0 if key was not moved.
func (*Redis) Mset ¶
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.
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.
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. return Status code reply Basically +OK as MSET can't fail
func (*Redis) Msetnx ¶
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.
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.
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. 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 ¶
get transaction of redis client ,when use transaction mode, you need to invoke this first
func (*Redis) ObjectEncoding ¶
ObjectEncoding ...
func (*Redis) ObjectIdletime ¶
ObjectIdletime ...
func (*Redis) ObjectRefcount ¶
objectRefcount ...
func (*Redis) Persist ¶
Undo a {@link #expire(String, int) expire} at turning the expire key into a normal 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 ¶
This command works exactly like EXPIRE but the time to live of the key is specified in milliseconds instead of seconds.
Return value Integer reply, specifically:
1 if the timeout was set. 0 if key does not exist.
func (*Redis) PexpireAt ¶
PEXPIREAT has the same effect and semantic as EXPIREAT, but the Unix time at which the key will expire is specified in milliseconds instead of seconds.
Return value Integer reply, specifically:
1 if the timeout was set. 0 if key does not exist.
func (*Redis) Pfmerge ¶
Pfmerge Merge multiple HyperLogLog values into an unique value that will approximate the cardinality of the union of the observed Sets of the source HyperLogLog structures.
The computed merged HyperLogLog is set to the destination variable, which is created if does not exist (defaulting to an empty HyperLogLog).
Return value Simple string reply: The command just returns OK.
func (*Redis) Pipelined ¶
func (r *Redis) Pipelined() *pipeline
get pipeline of redis client ,when use pipeline mode, you need to invoke this first
func (*Redis) Psetex ¶
PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds.
func (*Redis) Psubscribe ¶
func (r *Redis) Psubscribe(redisPubSub *RedisPubSub, patterns ...string) error
Psubscribe ...
func (*Redis) Pttl ¶
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) PubsubChannels ¶
PubsubChannels ...
func (*Redis) Quit ¶
Quit Ask the server to close the connection. The connection is closed as soon as all pending replies have been written to the client.
Return value Simple string reply: always OK.
func (*Redis) Readonly ¶
Enables read queries for a connection to a Redis Cluster replica node. Normally replica nodes will redirect clients to the authoritative master for the hash slot involved in a given command, however clients can use replicas in order to scale reads using the READONLY command.
READONLY tells a Redis Cluster replica node that the client is willing to read possibly stale data and is not interested in running write queries.
When the connection is in readonly mode, the cluster will send a redirection to the client only if the operation involves keys not served by the replica's master node. This may happen because:
The client sent a command about hash slots never served by the master of this replica. The cluster was reconfigured (for example resharded) and the replica is no longer able to serve commands for a given hash slot. Return value Simple string reply
func (*Redis) Rename ¶
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.
return Status code repy
func (*Redis) Renamenx ¶
Rename oldkey into newkey but fails if the destination key newkey already exists.
return Integer reply, specifically: 1 if the key was renamed 0 if the target key already exist
func (*Redis) Rpop ¶
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".
If the key does not exist or the list is already empty the special value 'nil' is returned.
return Bulk reply
func (*Redis) Rpoplpush ¶
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".
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.
return Bulk reply
func (*Redis) Rpush ¶
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.
return Integer reply, specifically, the number of elements inside the list after the push
operation.
func (*Redis) Rpushx ¶
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 ¶
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.
return Integer reply, specifically: 1 if the new element was added 0 if the element was
already a member of the set
func (*Redis) Scan ¶
func (r *Redis) Scan(cursor string, params ...*ScanParams) (*ScanResult, error)
Scan ...
func (*Redis) Scard ¶
Return the set cardinality (number of elements). If the key does not exist 0 is returned, like for empty sets. return Integer reply, specifically: the cardinality (number of elements) of the set as an
integer.
func (*Redis) ScriptExists ¶
ScriptExists ...
func (*Redis) Sdiff ¶
Return the difference between the Set stored at key1 and all the Sets key2, ..., keyN
<b>Example:</b> <pre> key1 = [x, a, b, c] key2 = [c] key3 = [a, d] SDIFF key1,key2,key3 => [x, b] </pre> Non existing keys are considered like empty sets.
return Return the members of a set resulting from the difference between the first set
provided and all the successive sets.
func (*Redis) Sdiffstore ¶
This command works exactly like {@link #sdiff(String...) SDIFF} but instead of being returned the resulting set is stored in dstkey. return Status code reply
func (*Redis) SentinelFailover ¶
SentinelFailover ...
func (*Redis) SentinelGetMasterAddrByName ¶
<pre> redis 127.0.0.1:26381> 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 ¶
<pre> redis 127.0.0.1:26381> sentinel masters 1) 1) "name"
- "mymaster"
- "ip"
- "127.0.0.1"
- "port"
- "6379"
- "runid"
- "93d4d4e6e9c06d0eea36e27f31924ac26576081d"
- "flags"
- "master"
- "pending-commands"
- "0"
- "last-ok-ping-reply"
- "423"
- "last-ping-reply"
- "423"
- "info-refresh"
- "6107"
- "num-slaves"
- "1"
- "num-other-sentinels"
- "2"
- "quorum"
- "2"
</pre> return
func (*Redis) SentinelMonitor ¶
SentinelMonitor ...
func (*Redis) SentinelRemove ¶
SentinelRemove ...
func (*Redis) SentinelReset ¶
<pre> redis 127.0.0.1:26381> sentinel reset mymaster (integer) 1 </pre> param pattern return
func (*Redis) SentinelSet ¶
SentinelSet ...
func (*Redis) SentinelSlaves ¶
<pre> redis 127.0.0.1:26381> sentinel slaves mymaster 1) 1) "name"
- "127.0.0.1:6380"
- "ip"
- "127.0.0.1"
- "port"
- "6380"
- "runid"
- "d7f6c0ca7572df9d2f33713df0dbf8c72da7c039"
- "flags"
- "slave"
- "pending-commands"
- "0"
- "last-ok-ping-reply"
- "47"
- "last-ping-reply"
- "47"
- "info-refresh"
- "657"
- "master-link-down-time"
- "0"
- "master-link-status"
- "ok"
- "master-host"
- "localhost"
- "master-port"
- "6379"
- "slave-priority"
- "100"
</pre> param masterName return
func (*Redis) Set ¶
Set the string value as value of the key. The string can't be longer than 1073741824 bytes (1 GB) return Status code reply
func (*Redis) SetWithParams ¶
see SetWithParamsAndTime(key, value, nxxx, expx string, time int64)
func (*Redis) SetWithParamsAndTime ¶
Set the string value as value of the key. The string can't be longer than 1073741824 bytes (1 GB). 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 ¶
Sets or clears the bit at offset in the string value stored at key.
The bit is either set or cleared depending on value, which can be either 0 or 1. When key does not exist, a new string value is created. The string is grown to make sure it can hold a bit at offset. The offset argument is required to be greater than or equal to 0, and smaller than 232 (this limits bitmaps to 512MB). When the string at key is grown, added bits are set to 0.
Warning: When setting the last possible bit (offset equal to 232 -1) 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 bit number 232 -1 (512MB allocation) takes ~300ms, setting bit number 230 -1 (128MB allocation) takes ~80ms, setting bit number 228 -1 (32MB allocation) takes ~30ms and setting bit number 226 -1 (8MB allocation) takes ~8ms. Note that once this first allocation is done, subsequent calls to SETBIT for the same key will not have the allocation overhead.
Return value Integer reply: the original bit value stored at offset.
func (*Redis) SetbitWithBool ¶
see Setbit(key string, offset int64, value string)
func (*Redis) Setex ¶
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.
return Status code reply
func (*Redis) Setnx ¶
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".
return Integer reply, specifically: 1 if the key was set 0 if the key was not set
func (*Redis) Setrange ¶
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.
Return value Integer reply: the length of the string after it was modified by the command.
func (*Redis) Sinter ¶
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.
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).
return Multi bulk reply, specifically the list of common elements.
func (*Redis) Sinterstore ¶
This commnad works exactly like {@link #sinter(String...) SINTER} but instead of being returned the resulting set is sotred as dstkey.
return Status code reply
func (*Redis) Sismember ¶
Return 1 if member is a member of the set stored at key, otherwise 0 is returned.
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) SlowlogGet ¶
SlowlogGet ...
func (*Redis) Smembers ¶
Return all the members (elements) of the set value stored at key. This is just syntax glue for {@link #sinter(String...) SINTER}.
return Multi bulk reply
func (*Redis) Smove ¶
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.
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.
An error is raised if the source or destination keys contain a non Set value.
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.
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. 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) SortStore ¶ added in v0.0.10
func (r *Redis) SortStore(key, dstkey string, sortingParameters ...SortingParams) (int64, error)
SortMulti ...
func (*Redis) Spop ¶
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.
The {@link #srandmember(String)} command does a similar work but the returned element is not removed from the Set.
return Bulk reply
func (*Redis) Srandmember ¶
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.
The SPOP command does a similar work but the returned element is popped (removed) from the Set.
return Bulk reply
func (*Redis) SrandmemberBatch ¶
see Srandmember(key string)
func (*Redis) Srem ¶
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.
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)
Sscan scan keys of set,see scan
func (*Redis) Strlen ¶
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
Subscribe ...
func (*Redis) Substr ¶
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.
The function handles out of range requests without raising an error, but just limiting the resulting range to the actual length of the string.
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.
return Bulk reply
func (*Redis) Sunion ¶
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}.
Non existing keys are considered like empty sets.
return Multi bulk reply, specifically the list of common elements.
func (*Redis) Sunionstore ¶
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.
return Status code reply
func (*Redis) Ttl ¶
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. 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 ¶
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) WaitReplicas ¶
Syncrhonous replication of Redis as described here: http://antirez.com/news/66 Since Java Object class has implemented "wait" method, we cannot use it, so I had to change the name of the method. Sorry :S
func (*Redis) Watch ¶
Marks the given keys to be watched for conditional execution of a transaction.
Return value Simple string reply: always OK.
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.
The score value can be the string representation of a double precision floating point number.
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)
see Zadd(key string, score float64, member string, mparams ...ZAddParams)
func (*Redis) Zcard ¶
Return the sorted set cardinality (number of elements). If the key does not exist 0 is returned, like for empty sorted sets.
return the cardinality (number of elements) of the set as an integer.
func (*Redis) Zcount ¶
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.
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.
For an introduction to sorted sets check the Introduction to Redis data types page.
return The new score
func (*Redis) Zinterstore ¶
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.
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.
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.
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.
return Integer reply, specifically the number of elements in the sorted set at dstkey
func (*Redis) ZinterstoreWithParams ¶
ZinterstoreWithParams ...
func (*Redis) Zlexcount ¶
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns the number of elements in the sorted set at key with a value between min and max.
The min and max arguments have the same meaning as described for ZRANGEBYLEX.
Return value Integer reply: the number of elements in the specified score range.
func (*Redis) Zrange ¶
Returns the specified range of elements in the sorted set stored at key. The elements are considered to be ordered from the lowest to the highest score. Lexicographical order is used for elements with equal score. See ZREVRANGE when you need the elements ordered from highest to lowest score (and descending lexicographical order for elements with equal score). Both start and stop are zero-based indexes, where 0 is the first element, 1 is the next element and so on. They can also be negative numbers indicating offsets from the end of the sorted set, with -1 being the last element of the sorted set, -2 the penultimate element and so on. start and stop are inclusive ranges, so for example ZRANGE myzset 0 1 will return both the first and the second element of the sorted set. Out of range indexes will not produce an error. If start is larger than the largest index in the sorted set, or start > stop, an empty list is returned. If stop is larger than the end of the sorted set Redis will treat it like it is the last element of the sorted set. It is possible to pass the WITHSCORES option in order to return the scores of the elements together with the elements. The returned list will contain value1,score1,...,valueN,scoreN instead of value1,...,valueN. Client libraries are free to return a more appropriate data type (suggestion: an array with (value, score) arrays/tuples). Return value Array reply: list of elements in the specified range (optionally with their scores, in case the WITHSCORES option is given).
func (*Redis) ZrangeByLex ¶
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between min and max.
If the elements in the sorted set have different scores, the returned elements are unspecified.
The elements are considered to be ordered from lower to higher strings as compared byte-by-byte using the memcmp() C function. Longer strings are considered greater than shorter strings if the common part is identical.
The optional LIMIT argument can be used to only get a range of the matching elements (similar to SELECT LIMIT offset, count in SQL). A negative count returns all elements from the offset. Keep in mind that if offset is large, the sorted set needs to be traversed for offset elements before getting to the elements to return, which can add up to O(N) time complexity. Return value Array reply: list of elements in the specified score range.
func (*Redis) ZrangeByLexBatch ¶
see ZrangeByLex()
func (*Redis) ZrangeByScore ¶
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).
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).
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.
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.
<b>Exclusive intervals and infinity</b>
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".
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:
{@code ZRANGEBYSCORE zset (1.3 5}
Will return all the values with score > 1.3 and <= 5, while for instance:
{@code ZRANGEBYSCORE zset (5 (10}
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
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 ¶
see Zrange()
func (*Redis) ZrangeByScoreWithScores ¶
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).
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).
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.
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.
<b>Exclusive intervals and infinity</b>
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".
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:
{@code ZRANGEBYSCORE zset (1.3 5}
Will return all the values with score > 1.3 and <= 5, while for instance:
{@code ZRANGEBYSCORE zset (5 (10}
Will return all the values with score > 5 and < 10 (5 and 10 excluded).
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)
see Zrange()
func (*Redis) ZrangeWithScores ¶
see Zrange()
func (*Redis) Zrank ¶
Return the rank (or index) or member in the sorted set at key, with scores being ordered from low to high.
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.
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 ¶
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.
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 ¶
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.
The meaning of min and max are the same of the ZRANGEBYLEX command. Similarly, this command actually returns the same elements that ZRANGEBYLEX would return if called with the same min and max arguments.
Return value Integer reply: the number of elements removed.
func (*Redis) ZremrangeByRank ¶
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.
func (*Redis) ZremrangeByScore ¶
Removes all elements in the sorted set stored at key with a score between min and max (inclusive).
Since version 2.1.6, min and max can be exclusive, following the syntax of ZRANGEBYSCORE.
Return value Integer reply: the number of elements removed.
func (*Redis) Zrevrange ¶
Returns the specified range of elements in the sorted set stored at key. The elements are considered to be ordered from the highest to the lowest score. Descending lexicographical order is used for elements with equal score. Apart from the reversed ordering, ZREVRANGE is similar to ZRANGE. Return value Array reply: list of elements in the specified range (optionally with their scores).
func (*Redis) ZrevrangeByLex ¶
When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between max and min.
Apart from the reversed ordering, ZREVRANGEBYLEX is similar to ZRANGEBYLEX.
Return value Array reply: list of elements in the specified score range.
func (*Redis) ZrevrangeByLexBatch ¶
see ZrevrangeByLex()
func (*Redis) ZrevrangeByScore ¶
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 ¶
see ZrevrangeByScore(key, max, min string)
func (*Redis) ZrevrangeByScoreWithScoresBatch ¶
func (r *Redis) ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) ([]Tuple, error)
see Zrevrange()
func (*Redis) ZrevrangeWithScores ¶
see Zrevrange()
func (*Redis) Zrevrank ¶
Return the rank (or index) or member in the sorted set at key, with scores being ordered from high to low.
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.
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)
Zscan scan keys of zset,see scan
func (*Redis) Zscore ¶
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.
return the score
func (*Redis) Zunionstore ¶
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.
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.
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.
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.
return Integer reply, specifically the number of elements in the sorted set at dstkey
type RedisCluster ¶
type RedisCluster struct { MaxAttempts int // contains filtered or unexported fields }
RedisCluster redis cluster tool
func NewRedisCluster ¶
func NewRedisCluster(option *ClusterOption) *RedisCluster
NewRedisCluster constructor
func (*RedisCluster) Append ¶
func (r *RedisCluster) Append(key, value string) (int64, error)
Append ...
func (*RedisCluster) Bitcount ¶
func (r *RedisCluster) Bitcount(key string) (int64, error)
Bitcount see comment in redis.go
func (*RedisCluster) BitcountRange ¶
BitcountRange see comment in redis.go
func (*RedisCluster) Bitfield ¶
func (r *RedisCluster) Bitfield(key string, arguments ...string) ([]int64, error)
Bitfield see comment in redis.go
func (*RedisCluster) Bitpos ¶
func (r *RedisCluster) Bitpos(key string, value bool, params ...BitPosParams) (int64, error)
Bitpos see comment in redis.go
func (*RedisCluster) Blpop ¶
func (r *RedisCluster) Blpop(args ...string) ([]string, error)
Blpop see comment in redis.go
func (*RedisCluster) BlpopTimout ¶
func (r *RedisCluster) BlpopTimout(timeout int, keys ...string) ([]string, error)
BlpopTimout see comment in redis.go
func (*RedisCluster) Brpop ¶
func (r *RedisCluster) Brpop(args ...string) ([]string, error)
Brpop see comment in redis.go
func (*RedisCluster) BrpopTimout ¶
func (r *RedisCluster) BrpopTimout(timeout int, keys ...string) ([]string, error)
BrpopTimout see comment in redis.go
func (*RedisCluster) Brpoplpush ¶
func (r *RedisCluster) Brpoplpush(source, destination string, timeout int) (string, error)
Brpoplpush ...
func (*RedisCluster) DecrBy ¶
func (r *RedisCluster) DecrBy(key string, decrement int64) (int64, error)
DecrBy ...
func (*RedisCluster) Del ¶
func (r *RedisCluster) Del(keys ...string) (int64, error)
Del delete one or more keys return the number of deleted keys
func (*RedisCluster) Echo ¶
func (r *RedisCluster) Echo(str string) (string, error)
Echo see comment in redis.go
func (*RedisCluster) Eval ¶
func (r *RedisCluster) Eval(script string, keyCount int, params ...string) (interface{}, error)
Eval ...
func (*RedisCluster) Evalsha ¶
func (r *RedisCluster) Evalsha(sha1 string, keyCount int, params ...string) (interface{}, error)
Evalsha ...
func (*RedisCluster) Exists ¶
func (r *RedisCluster) Exists(keys ...string) (int64, error)
Exists see comment in redis.go
func (*RedisCluster) Expire ¶
func (r *RedisCluster) Expire(key string, seconds int) (int64, error)
Expire ...
func (*RedisCluster) ExpireAt ¶
func (r *RedisCluster) ExpireAt(key string, unixtime int64) (int64, error)
ExpireAt ...
func (*RedisCluster) Geoadd ¶
func (r *RedisCluster) Geoadd(key string, longitude, latitude float64, member string) (int64, error)
Geoadd see comment in redis.go
func (*RedisCluster) GeoaddByMap ¶
func (r *RedisCluster) GeoaddByMap(key string, memberCoordinateMap map[string]GeoCoordinate) (int64, error)
GeoaddByMap see comment in redis.go
func (*RedisCluster) Geodist ¶
func (r *RedisCluster) Geodist(key string, member1, member2 string, unit ...GeoUnit) (float64, error)
Geodist see comment in redis.go
func (*RedisCluster) Geohash ¶
func (r *RedisCluster) Geohash(key string, members ...string) ([]string, error)
Geohash see comment in redis.go
func (*RedisCluster) Geopos ¶
func (r *RedisCluster) Geopos(key string, members ...string) ([]*GeoCoordinate, error)
Geopos see comment in redis.go
func (*RedisCluster) Georadius ¶
func (r *RedisCluster) Georadius(key string, longitude, latitude, radius float64, unit GeoUnit, param ...*GeoRadiusParam) ([]GeoRadiusResponse, error)
Georadius see comment in redis.go
func (*RedisCluster) GeoradiusByMember ¶
func (r *RedisCluster) GeoradiusByMember(key string, member string, radius float64, unit GeoUnit, param ...*GeoRadiusParam) ([]GeoRadiusResponse, error)
GeoradiusByMember see comment in redis.go
func (*RedisCluster) GetSet ¶
func (r *RedisCluster) GetSet(key, value string) (string, error)
GetSet ...
func (*RedisCluster) Getbit ¶
func (r *RedisCluster) Getbit(key string, offset int64) (bool, error)
Getbit ...
func (*RedisCluster) Getrange ¶
func (r *RedisCluster) Getrange(key string, startOffset, endOffset int64) (string, error)
Getrange ...
func (*RedisCluster) Hdel ¶
func (r *RedisCluster) Hdel(key string, fields ...string) (int64, error)
Hdel ...
func (*RedisCluster) Hexists ¶
func (r *RedisCluster) Hexists(key, field string) (bool, error)
Hexists ...
func (*RedisCluster) HgetAll ¶
func (r *RedisCluster) HgetAll(key string) (map[string]string, error)
HgetAll ...
func (*RedisCluster) HincrBy ¶
func (r *RedisCluster) HincrBy(key, field string, value int64) (int64, error)
HincrBy ...
func (*RedisCluster) HincrByFloat ¶
func (r *RedisCluster) HincrByFloat(key, field string, value float64) (float64, error)
HincrByFloat ...
func (*RedisCluster) Hmget ¶
func (r *RedisCluster) Hmget(key string, fields ...string) ([]string, error)
Hmget ...
func (*RedisCluster) Hscan ¶
func (r *RedisCluster) Hscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
Hscan see comment in redis.go
func (*RedisCluster) Hset ¶
func (r *RedisCluster) Hset(key, field string, value string) (int64, error)
Hset ...
func (*RedisCluster) Hsetnx ¶
func (r *RedisCluster) Hsetnx(key, field, value string) (int64, error)
Hsetnx ...
func (*RedisCluster) IncrBy ¶
func (r *RedisCluster) IncrBy(key string, increment int64) (int64, error)
IncrBy ...
func (*RedisCluster) IncrByFloat ¶
func (r *RedisCluster) IncrByFloat(key string, increment float64) (float64, error)
IncrByFloat ...
func (*RedisCluster) Lindex ¶
func (r *RedisCluster) Lindex(key string, index int64) (string, error)
Lindex ...
func (*RedisCluster) Linsert ¶
func (r *RedisCluster) Linsert(key string, where ListOption, pivot, value string) (int64, error)
Linsert see comment in redis.go
func (*RedisCluster) Lpush ¶
func (r *RedisCluster) Lpush(key string, strings ...string) (int64, error)
Lpush ...
func (*RedisCluster) Lpushx ¶
func (r *RedisCluster) Lpushx(key string, strs ...string) (int64, error)
Lpushx see comment in redis.go
func (*RedisCluster) Lrange ¶
func (r *RedisCluster) Lrange(key string, start, stop int64) ([]string, error)
Lrange ...
func (*RedisCluster) Ltrim ¶
func (r *RedisCluster) Ltrim(key string, start, stop int64) (string, error)
Ltrim ...
func (*RedisCluster) Mget ¶
func (r *RedisCluster) Mget(keys ...string) ([]string, error)
Mget see comment in redis.go
func (*RedisCluster) Mset ¶
func (r *RedisCluster) Mset(keysvalues ...string) (string, error)
Mset see comment in redis.go
func (*RedisCluster) Msetnx ¶
func (r *RedisCluster) Msetnx(keysvalues ...string) (int64, error)
Msetnx see comment in redis.go
func (*RedisCluster) Persist ¶
func (r *RedisCluster) Persist(key string) (int64, error)
Persist ...
func (*RedisCluster) Pexpire ¶
func (r *RedisCluster) Pexpire(key string, milliseconds int64) (int64, error)
Pexpire ...
func (*RedisCluster) PexpireAt ¶
func (r *RedisCluster) PexpireAt(key string, millisecondsTimestamp int64) (int64, error)
PexpireAt ...
func (*RedisCluster) Pfadd ¶
func (r *RedisCluster) Pfadd(key string, elements ...string) (int64, error)
Pfadd see comment in redis.go
func (*RedisCluster) Pfcount ¶
func (r *RedisCluster) Pfcount(keys ...string) (int64, error)
Pfcount ...
func (*RedisCluster) Pfmerge ¶
func (r *RedisCluster) Pfmerge(destkey string, sourcekeys ...string) (string, error)
Pfmerge ...
func (*RedisCluster) Psubscribe ¶
func (r *RedisCluster) Psubscribe(redisPubSub *RedisPubSub, patterns ...string) error
Psubscribe ...
func (*RedisCluster) Publish ¶
func (r *RedisCluster) Publish(channel, message string) (int64, error)
Publish ...
func (*RedisCluster) Rename ¶
func (r *RedisCluster) Rename(oldkey, newkey string) (string, error)
Rename see comment in redis.go
func (*RedisCluster) Renamenx ¶
func (r *RedisCluster) Renamenx(oldkey, newkey string) (int64, error)
Renamenx see comment in redis.go
func (*RedisCluster) Rpoplpush ¶
func (r *RedisCluster) Rpoplpush(srckey, dstkey string) (string, error)
Rpoplpush see comment in redis.go
func (*RedisCluster) Rpush ¶
func (r *RedisCluster) Rpush(key string, strings ...string) (int64, error)
Rpush ...
func (*RedisCluster) Rpushx ¶
func (r *RedisCluster) Rpushx(key string, strs ...string) (int64, error)
Rpushx see comment in redis.go
func (*RedisCluster) Sadd ¶
func (r *RedisCluster) Sadd(key string, members ...string) (int64, error)
Sadd ...
func (*RedisCluster) Scan ¶
func (r *RedisCluster) Scan(cursor string, params ...*ScanParams) (*ScanResult, error)
Scan ...
func (*RedisCluster) Scard ¶
func (r *RedisCluster) Scard(key string) (int64, error)
Scard see comment in redis.go
func (*RedisCluster) ScriptExists ¶
func (r *RedisCluster) ScriptExists(key string, sha1 ...string) ([]bool, error)
ScriptExists ...
func (*RedisCluster) ScriptLoad ¶
func (r *RedisCluster) ScriptLoad(key, script string) (string, error)
ScriptLoad ...
func (*RedisCluster) Sdiff ¶
func (r *RedisCluster) Sdiff(keys ...string) ([]string, error)
Sdiff see comment in redis.go
func (*RedisCluster) Sdiffstore ¶
func (r *RedisCluster) Sdiffstore(dstkey string, keys ...string) (int64, error)
Sdiffstore see comment in redis.go
func (*RedisCluster) Set ¶
func (r *RedisCluster) Set(key, value string) (string, error)
Set set key/value,without timeout
func (*RedisCluster) SetWithParams ¶
func (r *RedisCluster) SetWithParams(key, value, nxxx string) (string, error)
SetWithParams ...
func (*RedisCluster) SetWithParamsAndTime ¶
func (r *RedisCluster) SetWithParamsAndTime(key, value, nxxx, expx string, time int64) (string, error)
SetWithParamsAndTime ...
func (*RedisCluster) SetbitWithBool ¶
SetbitWithBool ...
func (*RedisCluster) Setnx ¶
func (r *RedisCluster) Setnx(key, value string) (int64, error)
Setnx ...
func (*RedisCluster) Sinter ¶
func (r *RedisCluster) Sinter(keys ...string) ([]string, error)
Sinter see comment in redis.go
func (*RedisCluster) Sinterstore ¶
func (r *RedisCluster) Sinterstore(dstkey string, keys ...string) (int64, error)
Sinterstore see comment in redis.go
func (*RedisCluster) Sismember ¶
func (r *RedisCluster) Sismember(key string, member string) (bool, error)
Sismember see comment in redis.go
func (*RedisCluster) Smembers ¶
func (r *RedisCluster) Smembers(key string) ([]string, error)
Smembers ...
func (*RedisCluster) Smove ¶
func (r *RedisCluster) Smove(srckey, dstkey, member string) (int64, error)
Smove see comment in redis.go
func (*RedisCluster) Sort ¶
func (r *RedisCluster) Sort(key string, sortingParameters ...SortingParams) ([]string, error)
Sort see comment in redis.go
func (*RedisCluster) SortStore ¶ added in v0.0.10
func (r *RedisCluster) SortStore(key, dstkey string, sortingParameters ...SortingParams) (int64, error)
SortMulti see comment in redis.go
func (*RedisCluster) SpopBatch ¶
func (r *RedisCluster) SpopBatch(key string, count int64) ([]string, error)
SpopBatch see comment in redis.go
func (*RedisCluster) Srandmember ¶
func (r *RedisCluster) Srandmember(key string) (string, error)
Srandmember see comment in redis.go
func (*RedisCluster) SrandmemberBatch ¶
func (r *RedisCluster) SrandmemberBatch(key string, count int) ([]string, error)
SrandmemberBatch see comment in redis.go
func (*RedisCluster) Srem ¶
func (r *RedisCluster) Srem(key string, members ...string) (int64, error)
Srem ...
func (*RedisCluster) Sscan ¶
func (r *RedisCluster) Sscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
Sscan see comment in redis.go
func (*RedisCluster) Strlen ¶
func (r *RedisCluster) Strlen(key string) (int64, error)
Strlen see comment in redis.go
func (*RedisCluster) Subscribe ¶
func (r *RedisCluster) Subscribe(redisPubSub *RedisPubSub, channels ...string) error
Subscribe ...
func (*RedisCluster) Substr ¶
func (r *RedisCluster) Substr(key string, start, end int) (string, error)
Substr ...
func (*RedisCluster) Sunion ¶
func (r *RedisCluster) Sunion(keys ...string) ([]string, error)
Sunion see comment in redis.go
func (*RedisCluster) Sunionstore ¶
func (r *RedisCluster) Sunionstore(dstkey string, keys ...string) (int64, error)
Sunionstore see comment in redis.go
func (*RedisCluster) Zadd ¶
func (r *RedisCluster) Zadd(key string, score float64, member string, params ...*ZAddParams) (int64, error)
Zadd see comment in redis.go
func (*RedisCluster) ZaddByMap ¶
func (r *RedisCluster) ZaddByMap(key string, scoreMembers map[string]float64, params ...*ZAddParams) (int64, error)
ZaddByMap see comment in redis.go
func (*RedisCluster) Zcard ¶
func (r *RedisCluster) Zcard(key string) (int64, error)
Zcard see comment in redis.go
func (*RedisCluster) Zincrby ¶
func (r *RedisCluster) Zincrby(key string, score float64, member string, params ...*ZAddParams) (float64, error)
Zincrby see comment in redis.go
func (*RedisCluster) Zinterstore ¶
func (r *RedisCluster) Zinterstore(dstkey string, sets ...string) (int64, error)
Zinterstore see comment in redis.go
func (*RedisCluster) ZinterstoreWithParams ¶
func (r *RedisCluster) ZinterstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
ZinterstoreWithParams ...
func (*RedisCluster) Zlexcount ¶
func (r *RedisCluster) Zlexcount(key, min, max string) (int64, error)
Zlexcount see comment in redis.go
func (*RedisCluster) Zrange ¶
func (r *RedisCluster) Zrange(key string, start, end int64) ([]string, error)
Zrange see comment in redis.go
func (*RedisCluster) ZrangeByLex ¶
func (r *RedisCluster) ZrangeByLex(key, min, max string) ([]string, error)
ZrangeByLex see comment in redis.go
func (*RedisCluster) ZrangeByLexBatch ¶
func (r *RedisCluster) ZrangeByLexBatch(key, min, max string, offset, count int) ([]string, error)
ZrangeByLexBatch see comment in redis.go
func (*RedisCluster) ZrangeByScore ¶
ZrangeByScore see comment in redis.go
func (*RedisCluster) ZrangeByScoreBatch ¶
func (r *RedisCluster) ZrangeByScoreBatch(key string, min string, max string, offset int, count int) ([]string, error)
ZrangeByScoreBatch see comment in redis.go
func (*RedisCluster) ZrangeByScoreWithScores ¶
func (r *RedisCluster) ZrangeByScoreWithScores(key, min, max string) ([]Tuple, error)
ZrangeByScoreWithScores see comment in redis.go
func (*RedisCluster) ZrangeByScoreWithScoresBatch ¶
func (r *RedisCluster) ZrangeByScoreWithScoresBatch(key, min, max string, offset, count int) ([]Tuple, error)
ZrangeByScoreWithScoresBatch see comment in redis.go
func (*RedisCluster) ZrangeWithScores ¶
func (r *RedisCluster) ZrangeWithScores(key string, start, end int64) ([]Tuple, error)
ZrangeWithScores see comment in redis.go
func (*RedisCluster) Zrank ¶
func (r *RedisCluster) Zrank(key, member string) (int64, error)
Zrank see comment in redis.go
func (*RedisCluster) Zrem ¶
func (r *RedisCluster) Zrem(key string, member ...string) (int64, error)
Zrem see comment in redis.go
func (*RedisCluster) ZremrangeByLex ¶
func (r *RedisCluster) ZremrangeByLex(key, min, max string) (int64, error)
ZremrangeByLex see comment in redis.go
func (*RedisCluster) ZremrangeByRank ¶
func (r *RedisCluster) ZremrangeByRank(key string, start, end int64) (int64, error)
ZremrangeByRank see comment in redis.go
func (*RedisCluster) ZremrangeByScore ¶
func (r *RedisCluster) ZremrangeByScore(key, start, end string) (int64, error)
ZremrangeByScore see comment in redis.go
func (*RedisCluster) Zrevrange ¶
func (r *RedisCluster) Zrevrange(key string, start, end int64) ([]string, error)
Zrevrange see comment in redis.go
func (*RedisCluster) ZrevrangeByLex ¶
func (r *RedisCluster) ZrevrangeByLex(key, max, min string) ([]string, error)
ZrevrangeByLex see comment in redis.go
func (*RedisCluster) ZrevrangeByLexBatch ¶
func (r *RedisCluster) ZrevrangeByLexBatch(key, max, min string, offset, count int) ([]string, error)
ZrevrangeByLexBatch see comment in redis.go
func (*RedisCluster) ZrevrangeByScore ¶
ZrevrangeByScore see comment in redis.go
func (*RedisCluster) ZrevrangeByScoreWithScores ¶
func (r *RedisCluster) ZrevrangeByScoreWithScores(key, max, min string) ([]Tuple, error)
ZrevrangeByScoreWithScores see comment in redis.go
func (*RedisCluster) ZrevrangeByScoreWithScoresBatch ¶
func (r *RedisCluster) ZrevrangeByScoreWithScoresBatch(key, max, min string, offset, count int) ([]Tuple, error)
ZrevrangeByScoreWithScoresBatch see comment in redis.go
func (*RedisCluster) ZrevrangeWithScores ¶
func (r *RedisCluster) ZrevrangeWithScores(key string, start, end int64) ([]Tuple, error)
ZrevrangeWithScores see comment in redis.go
func (*RedisCluster) Zrevrank ¶
func (r *RedisCluster) Zrevrank(key, member string) (int64, error)
Zrevrank see comment in redis.go
func (*RedisCluster) Zscan ¶
func (r *RedisCluster) Zscan(key, cursor string, params ...*ScanParams) (*ScanResult, error)
Zscan see comment in redis.go
func (*RedisCluster) Zscore ¶
func (r *RedisCluster) Zscore(key, member string) (float64, error)
Zscore see comment in redis.go
func (*RedisCluster) Zunionstore ¶
func (r *RedisCluster) Zunionstore(dstkey string, sets ...string) (int64, error)
Zunionstore ...
func (*RedisCluster) ZunionstoreWithParams ¶
func (r *RedisCluster) ZunionstoreWithParams(dstkey string, params ZParams, sets ...string) (int64, error)
ZunionstoreWithParams ...
type RedisError ¶ added in v0.0.5
type RedisError struct {
Message string
}
RedisError basic redis error
func (*RedisError) Error ¶ added in v0.0.5
func (e *RedisError) Error() string
type RedisPubSub ¶
type RedisPubSub struct { 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 }
RedisPubSub ...
func (*RedisPubSub) Psubscribe ¶
func (r *RedisPubSub) Psubscribe(channels ...string) error
Psubscribe ...
func (*RedisPubSub) Punsubscribe ¶
func (r *RedisPubSub) Punsubscribe(channels ...string) error
Punsubscribe ...
func (*RedisPubSub) Subscribe ¶
func (r *RedisPubSub) Subscribe(channels ...string) error
Subscribe ...
func (*RedisPubSub) Unsubscribe ¶
func (r *RedisPubSub) Unsubscribe(channels ...string) error
Unsubscribe ...
type ScanParams ¶
type ScanParams struct {
// contains filtered or unexported fields
}
ScanParams
func (ScanParams) GetParams ¶ added in v0.0.3
func (s ScanParams) GetParams() [][]byte
GetParams ...
type ScanResult ¶
ScanResult ...
func ObjectArrToScanResultReply ¶
func ObjectArrToScanResultReply(reply []interface{}, err error) (*ScanResult, error)
ObjectArrToScanResultReply convert object array reply to scanresult reply
func ToScanResultReply ¶
func ToScanResultReply(reply interface{}, err error) (*ScanResult, error)
ToScanResultReply convert object reply to scanresult reply
type SortingParams ¶
type SortingParams struct {
// contains filtered or unexported fields
}
SortingParams
func NewSortingParams ¶ added in v0.0.10
func NewSortingParams() *SortingParams
func (*SortingParams) Alpha ¶ added in v0.0.10
func (p *SortingParams) Alpha() *SortingParams
func (*SortingParams) Asc ¶ added in v0.0.10
func (p *SortingParams) Asc() *SortingParams
func (*SortingParams) By ¶ added in v0.0.10
func (p *SortingParams) By(pattern string) *SortingParams
func (*SortingParams) Desc ¶ added in v0.0.10
func (p *SortingParams) Desc() *SortingParams
func (*SortingParams) Get ¶ added in v0.0.10
func (p *SortingParams) Get(patterns ...string) *SortingParams
func (*SortingParams) GetParams ¶ added in v0.0.10
func (p *SortingParams) GetParams() [][]byte
func (*SortingParams) Limit ¶ added in v0.0.10
func (p *SortingParams) Limit(start, count int) *SortingParams
func (*SortingParams) NoSort ¶ added in v0.0.10
func (p *SortingParams) NoSort() *SortingParams
type Tuple ¶
type Tuple struct {
// contains filtered or unexported fields
}
Tuple ...
func StringArrToTupleReply ¶
StringArrToTupleReply convert string array reply to tuple array reply
func ToTupleArrayReply ¶
ToTupleArrayReply convert object reply to tuple array reply
type ZAddParams ¶
type ZAddParams struct {
// contains filtered or unexported fields
}
ZAddParams ...
func (*ZAddParams) CH ¶
func (p *ZAddParams) CH() *ZAddParams
func (*ZAddParams) Contains ¶ added in v0.0.3
func (p *ZAddParams) Contains(key string) bool
Contains ...
func (*ZAddParams) GetByteParams ¶ added in v0.0.3
func (p *ZAddParams) GetByteParams(key []byte, args ...[]byte) [][]byte
GetByteParams ...
func (*ZAddParams) NX ¶
func (p *ZAddParams) NX() *ZAddParams
func (*ZAddParams) XX ¶
func (p *ZAddParams) XX() *ZAddParams