Documentation ¶
Index ¶
- Constants
- Variables
- func DBIndexValid(index int) bool
- func ReleaseBatch(b *Batch)
- type Aggregate
- type Arg
- func Bool(b bool) Arg
- func Float32(f float32) Arg
- func Float64(f float64) Arg
- func Int(n int) Arg
- func Int16(n int16) Arg
- func Int32(n int32) Arg
- func Int64(n int64) Arg
- func Int8(n int8) Arg
- func Key(s string) Arg
- func Lex(lex string, inclusive bool) Arg
- func MaxLex() Arg
- func MaxScore() Arg
- func Milliseconds(d time.Duration) Arg
- func MinLex() Arg
- func MinScore() Arg
- func QuickArgs(key string, args ...string) []Arg
- func Score(score float64, inclusive bool) Arg
- func Seconds(d time.Duration) Arg
- func String(s string) Arg
- func Uint(n uint) Arg
- func Uint16(n uint16) Arg
- func Uint32(n uint32) Arg
- func Uint64(n uint64) Arg
- func Uint8(n uint8) Arg
- func UnixMilliseconds(tm time.Time) Arg
- func UnixSeconds(tm time.Time) Arg
- type ArgBuilder
- func (a *ArgBuilder) Append(args ...Arg)
- func (a *ArgBuilder) Arg(arg Arg)
- func (a *ArgBuilder) Args() (args []Arg)
- func (a *ArgBuilder) Clear()
- func (a *ArgBuilder) Field(name string, value Arg)
- func (a *ArgBuilder) Flag(flag string, ok bool)
- func (a *ArgBuilder) Float(f float64)
- func (a *ArgBuilder) Int(n int64)
- func (a *ArgBuilder) KV(key string, arg Arg)
- func (a *ArgBuilder) Key(key string)
- func (a *ArgBuilder) Keys(keys ...string)
- func (a *ArgBuilder) KeysUnique(key string, keys ...string)
- func (a *ArgBuilder) Len() int
- func (a *ArgBuilder) Milliseconds(d time.Duration)
- func (a *ArgBuilder) Option(option, value string)
- func (a *ArgBuilder) Reset()
- func (a *ArgBuilder) Score(score float64, include bool)
- func (a *ArgBuilder) Seconds(d time.Duration)
- func (a *ArgBuilder) String(str string)
- func (a *ArgBuilder) Strings(args ...string)
- func (a *ArgBuilder) Swap(args []Arg) []Arg
- func (a *ArgBuilder) Unique(arg string, args ...string)
- type AssertNonNullArray
- type AssertOK
- type Batch
- func (b *Batch) Append(key, value string) *ReplyBulkString
- func (b *Batch) Decr(key string) *ReplyInteger
- func (b *Batch) DecrBy(key string, d int64) *ReplyInteger
- func (b *Batch) Del(key string, keys ...string) *ReplyInteger
- func (b *Batch) Do(cmd string, args ...Arg) *ReplyAny
- func (b *Batch) Dump(key string) *ReplyBulkString
- func (b *Batch) Exists(keys ...string) *ReplyInteger
- func (b *Batch) Expire(key string, ttl time.Duration) *ReplyInteger
- func (b *Batch) ExpireAt(key string, tm time.Time) *ReplyInteger
- func (b *Batch) FlushDB(async bool) *ReplyOK
- func (b *Batch) Get(key string) *ReplyBulkString
- func (b *Batch) GetRange(key string, start, end int64) *ReplyBulkString
- func (b *Batch) GetSet(key, value string) *ReplyBulkString
- func (b *Batch) HDel(key, field string, fields ...string) *ReplyInteger
- func (b *Batch) HExists(key, field string) *ReplyBool
- func (b *Batch) HGet(key, field string) *ReplyBulkString
- func (b *Batch) HGetAll(key string) *ReplyBulkStringArray
- func (b *Batch) HIncrBy(key, field string, incr int64) *ReplyInteger
- func (b *Batch) HIncrByFloat(key, field string, incr float64) *ReplyFloat
- func (b *Batch) HKeys(key string) *ReplyBulkStringArray
- func (b *Batch) HLen(key string) *ReplyInteger
- func (b *Batch) HMGet(key, field string, fields ...string) *ReplyBulkStringArray
- func (b *Batch) HSet(key, field, value string, entries ...string) *ReplyInteger
- func (b *Batch) HSetArg(key string, field string, value Arg, entries ...HArg) *ReplyInteger
- func (b *Batch) HSetNX(key, field, value string) *ReplyBool
- func (b *Batch) HSetNXArg(key, field string, value Arg) *ReplyBool
- func (b *Batch) HStrLen(key, field string) *ReplyInteger
- func (b *Batch) HVals(key string) *ReplyBulkStringArray
- func (b *Batch) Incr(key string) *ReplyInteger
- func (b *Batch) IncrBy(key string, n int64) *ReplyInteger
- func (b *Batch) IncrByFloat(key string, incr float64) *ReplyFloat
- func (b *Batch) Keys(pattern string) *ReplyBulkStringArray
- func (c *Batch) LIndex(key string, index int64) *ReplyInteger
- func (c *Batch) LInsertAfter(key string, pivot int64, value Arg) *ReplyInteger
- func (c *Batch) LInsertBefore(key string, pivot int64, value Arg) *ReplyInteger
- func (c *Batch) LLen(key string) *ReplyInteger
- func (c *Batch) LPop(key string) *ReplyBulkString
- func (c *Batch) LPush(key string, values ...Arg) *ReplyInteger
- func (c *Batch) LPushX(key string, values ...Arg) *ReplyInteger
- func (c *Batch) LRange(key string, start, stop int64) *ReplyBulkStringArray
- func (c *Batch) LRem(key string, count int64, element Arg) *ReplyInteger
- func (c *Batch) LSet(key string, index int64, element Arg) *ReplyOK
- func (c *Batch) LTrim(key string, start, stop int64) *ReplyInteger
- func (b *Batch) MGet(key string, keys ...string) *ReplyBulkStringArray
- func (b *Batch) MSet(values ...string) *ReplyOK
- func (b *Batch) MSetArg(values map[string]Arg) *ReplyOK
- func (b *Batch) MSetNX(values ...string) *ReplyBool
- func (b *Batch) Migrate(m Migrate) *ReplyOK
- func (b *Batch) Move(key string, db int) *ReplyInteger
- func (b *Batch) Multi(tx *Tx) *ReplyTX
- func (b *Batch) ObjectEncoding(key string) *ReplyBulkString
- func (b *Batch) ObjectFreq(key string) *ReplyInteger
- func (b *Batch) ObjectHelp(key string) *ReplyBulkString
- func (b *Batch) ObjectIdleTime(key string) *ReplyInteger
- func (b *Batch) ObjectRefCount(key string) *ReplyInteger
- func (b *Batch) PExpire(key string, ttl time.Duration) *ReplyInteger
- func (b *Batch) PExpireAt(key string, tm time.Time) *ReplyInteger
- func (b *Batch) PTTL(key string) *ReplyInteger
- func (b *Batch) Persist(key string) *ReplyInteger
- func (b Batch) PubSubChannels(pattern string) *ReplyBulkStringArray
- func (b *Batch) PubSubNumPat() *ReplyInteger
- func (b *Batch) PubSubNumSub(channels ...string) *ReplyInteger
- func (b *Batch) Publish(channel, msg string) *ReplyInteger
- func (c *Batch) RPop(key string) *ReplyBulkString
- func (c *Batch) RPopLPush(src, dest string, timeout time.Duration) *ReplyBulkString
- func (c *Batch) RPush(key string, elements ...Arg) *ReplyInteger
- func (c *Batch) RPushX(key string, elements ...Arg) *ReplyInteger
- func (b *Batch) RandomKey() *ReplyBulkString
- func (b *Batch) Rename(key, newkey string) *ReplyOK
- func (b *Batch) RenameNX(key, newkey string) *ReplyOK
- func (b *Batch) Reset()
- func (b *Batch) Restore(r Restore) *ReplyOK
- func (b *Batch) Set(key, value string, ttl time.Duration) *ReplyOK
- func (b *Batch) SetEX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Batch) SetNX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Batch) SetRange(key string, offset int64, value string) *ReplyBulkString
- func (b *Batch) SetXX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Batch) Sort(key string, sort Sort) *ReplyBulkStringArray
- func (b *Batch) SortStore(dest, key string, sort Sort) *ReplyInteger
- func (b *Batch) StrLen(key string) *ReplyBulkString
- func (b *Batch) TTL(key string) *ReplyInteger
- func (b *Batch) Touch(keys ...string) *ReplyInteger
- func (b *Batch) Type(key string) *ReplySimpleString
- func (b *Batch) Unlink(keys ...string) *ReplyInteger
- func (b *Batch) Unwatch() *ReplyOK
- func (b *Batch) Wait(numReplicas int, timeout time.Duration) *ReplyInteger
- func (b *Batch) Watch(keys ...string) *ReplyOK
- func (b *Batch) XAck(key, group string, id string, ids ...string) *ReplyInteger
- func (b *Batch) XAdd(key string, maxLen int64, id string, fields ...HArg) *ReplyBulkString
- func (b *Batch) XDel(key string, ids ...string) *ReplyInteger
- func (b *Batch) XGroupCreate(key, group, id string, makeStream bool) *ReplyOK
- func (b *Batch) XGroupDelConsumer(key, group, consumer string) *ReplyInteger
- func (b *Batch) XGroupDestroy(key, group string) *ReplyInteger
- func (b *Batch) XGroupSetID(key, group, id string) *ReplyOK
- func (b *Batch) XInfoConsumers(key, group string) *ReplyXInfoConsumers
- func (b *Batch) XInfoGroups(key string) *ReplyXInfoGroups
- func (b *Batch) XInfoHelp() *ReplyBulkStringArray
- func (b *Batch) XInfoStream(key string) *ReplyXInfoStream
- func (b *Batch) XLen(key string) *ReplyInteger
- func (b *Batch) XPending(key, group string) *ReplyXPendingSummary
- func (b *Batch) XPendingConsumer(args XPending) *ReplyXPending
- func (b *Batch) XPendingGroup(args XPending) *ReplyXPending
- func (b *Batch) XRange(key, group, start, end string, count int64) *ReplyXRange
- func (b *Batch) XRevRange(key, group, end, start string, count int64) *ReplyXRange
- func (b *Batch) ZAdd(key string, mode Mode, members ...ZEntry) *ReplyInteger
- func (b *Batch) ZAddIncr(key string, mode Mode, member string, d float64) *ReplyFloat
- func (b *Batch) ZCard(key string) *ReplyInteger
- func (b *Batch) ZCount(key string, min, max Arg) *ReplyInteger
- func (b *Batch) ZIncrBy(key string, incr float64, member string) *ReplyFloat
- func (b *Batch) ZInterStore(args ZStore) *ReplyInteger
- func (b *Batch) ZLexCount(key string, min, max Arg) *ReplyInteger
- func (b *Batch) ZPopMax(key string, count int64) *ReplyZRange
- func (b *Batch) ZPopMin(key string, count int64) *ReplyZRange
- func (b *Batch) ZRange(key string, start, stop int64) *ReplyBulkStringArray
- func (b *Batch) ZRangeByLex(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Batch) ZRangeByScore(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Batch) ZRangeByScoreWithScores(key string, min, max Arg, offset, count int64) *ReplyZRange
- func (b *Batch) ZRangeWithScores(key string, start, stop int64) *ReplyZRange
- func (b *Batch) ZRank(key, member string) *ReplyInteger
- func (b *Batch) ZRem(key string, members ...string) *ReplyInteger
- func (b *Batch) ZRemRangeByLex(key string, min, max Arg) *ReplyInteger
- func (b *Batch) ZRemRangeByRank(key string, start, stop int64) *ReplyInteger
- func (b *Batch) ZRemRangeByScore(key string, min, max Arg) *ReplyInteger
- func (b *Batch) ZRevRange(key string, start, stop int64) *ReplyBulkStringArray
- func (b *Batch) ZRevRangeByLex(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Batch) ZRevRangeByScore(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Batch) ZRevRangeByScoreWithScores(key string, max, min Arg, offset, count int64) *ReplyZRange
- func (b *Batch) ZRevRangeWithScores(key string, start, stop int64) *ReplyZRange
- func (b *Batch) ZRevRank(key, member string) *ReplyInteger
- func (b *Batch) ZScore(key, member string) *ReplyFloat
- func (b *Batch) ZUnionStore(args ZStore) *ReplyInteger
- type CommandBuilder
- type CommandWriter
- type Conn
- func (conn *Conn) Auth(password string) error
- func (c *Conn) BLPop(timeout time.Duration, key string, keys ...string) (pop Pop, err error)
- func (c *Conn) BRPop(timeout time.Duration, key string, keys ...string) (pop Pop, err error)
- func (c *Conn) BRPopLPush(src, dst string, timeout time.Duration) (el string, err error)
- func (conn *Conn) BZPopMax(timeout time.Duration, key string, keys ...string) (z ZPop, err error)
- func (conn *Conn) BZPopMin(timeout time.Duration, key string, keys ...string) (z ZPop, err error)
- func (conn *Conn) Close() error
- func (conn *Conn) Dirty() bool
- func (c *Conn) DoBatch(b *Batch) error
- func (conn *Conn) DoCommand(dest interface{}, name string, args ...Arg) error
- func (conn *Conn) Err() error
- func (conn *Conn) Eval(dest interface{}, script string, numKeys int, args ...string) error
- func (conn *Conn) LoadScript(script string) (string, error)
- func (c *Conn) Pipeline() (*Pipeline, error)
- func (conn *Conn) Reset(options *ConnOptions) error
- func (conn *Conn) Scan(dest interface{}) error
- func (conn *Conn) ScanMulti(dest ...interface{}) error
- func (conn *Conn) Subscriber(queueSize int) (*Subscriber, error)
- func (conn *Conn) WriteCommand(name string, args ...Arg) error
- func (conn *Conn) WriteEval(script string, numKeys int, args ...string) error
- func (conn *Conn) WriteQuick(name, key string, args ...string) error
- type ConnOptions
- type DialFunc
- type HArg
- type HSet
- type Migrate
- type Mode
- type Pipeline
- func (b *Pipeline) Append(key, value string) *ReplyBulkString
- func (p *Pipeline) Close() error
- func (b *Pipeline) Decr(key string) *ReplyInteger
- func (b *Pipeline) DecrBy(key string, d int64) *ReplyInteger
- func (b *Pipeline) Del(key string, keys ...string) *ReplyInteger
- func (b *Pipeline) Do(cmd string, args ...Arg) *ReplyAny
- func (b *Pipeline) Dump(key string) *ReplyBulkString
- func (b *Pipeline) Exists(keys ...string) *ReplyInteger
- func (b *Pipeline) Expire(key string, ttl time.Duration) *ReplyInteger
- func (b *Pipeline) ExpireAt(key string, tm time.Time) *ReplyInteger
- func (b *Pipeline) FlushDB(async bool) *ReplyOK
- func (b *Pipeline) Get(key string) *ReplyBulkString
- func (b *Pipeline) GetRange(key string, start, end int64) *ReplyBulkString
- func (b *Pipeline) GetSet(key, value string) *ReplyBulkString
- func (b *Pipeline) HDel(key, field string, fields ...string) *ReplyInteger
- func (b *Pipeline) HExists(key, field string) *ReplyBool
- func (b *Pipeline) HGet(key, field string) *ReplyBulkString
- func (b *Pipeline) HGetAll(key string) *ReplyBulkStringArray
- func (b *Pipeline) HIncrBy(key, field string, incr int64) *ReplyInteger
- func (b *Pipeline) HIncrByFloat(key, field string, incr float64) *ReplyFloat
- func (b *Pipeline) HKeys(key string) *ReplyBulkStringArray
- func (b *Pipeline) HLen(key string) *ReplyInteger
- func (b *Pipeline) HMGet(key, field string, fields ...string) *ReplyBulkStringArray
- func (b *Pipeline) HSet(key, field, value string, entries ...string) *ReplyInteger
- func (b *Pipeline) HSetArg(key string, field string, value Arg, entries ...HArg) *ReplyInteger
- func (b *Pipeline) HSetNX(key, field, value string) *ReplyBool
- func (b *Pipeline) HSetNXArg(key, field string, value Arg) *ReplyBool
- func (b *Pipeline) HStrLen(key, field string) *ReplyInteger
- func (b *Pipeline) HVals(key string) *ReplyBulkStringArray
- func (b *Pipeline) Incr(key string) *ReplyInteger
- func (b *Pipeline) IncrBy(key string, n int64) *ReplyInteger
- func (b *Pipeline) IncrByFloat(key string, incr float64) *ReplyFloat
- func (b *Pipeline) Keys(pattern string) *ReplyBulkStringArray
- func (c *Pipeline) LIndex(key string, index int64) *ReplyInteger
- func (c *Pipeline) LInsertAfter(key string, pivot int64, value Arg) *ReplyInteger
- func (c *Pipeline) LInsertBefore(key string, pivot int64, value Arg) *ReplyInteger
- func (c *Pipeline) LLen(key string) *ReplyInteger
- func (c *Pipeline) LPop(key string) *ReplyBulkString
- func (c *Pipeline) LPush(key string, values ...Arg) *ReplyInteger
- func (c *Pipeline) LPushX(key string, values ...Arg) *ReplyInteger
- func (c *Pipeline) LRange(key string, start, stop int64) *ReplyBulkStringArray
- func (c *Pipeline) LRem(key string, count int64, element Arg) *ReplyInteger
- func (c *Pipeline) LSet(key string, index int64, element Arg) *ReplyOK
- func (c *Pipeline) LTrim(key string, start, stop int64) *ReplyInteger
- func (b *Pipeline) MGet(key string, keys ...string) *ReplyBulkStringArray
- func (b *Pipeline) MSet(values ...string) *ReplyOK
- func (b *Pipeline) MSetArg(values map[string]Arg) *ReplyOK
- func (b *Pipeline) MSetNX(values ...string) *ReplyBool
- func (b *Pipeline) Migrate(m Migrate) *ReplyOK
- func (b *Pipeline) Move(key string, db int) *ReplyInteger
- func (b *Pipeline) ObjectEncoding(key string) *ReplyBulkString
- func (b *Pipeline) ObjectFreq(key string) *ReplyInteger
- func (b *Pipeline) ObjectHelp(key string) *ReplyBulkString
- func (b *Pipeline) ObjectIdleTime(key string) *ReplyInteger
- func (b *Pipeline) ObjectRefCount(key string) *ReplyInteger
- func (b *Pipeline) PExpire(key string, ttl time.Duration) *ReplyInteger
- func (b *Pipeline) PExpireAt(key string, tm time.Time) *ReplyInteger
- func (b *Pipeline) PTTL(key string) *ReplyInteger
- func (b *Pipeline) Persist(key string) *ReplyInteger
- func (b Pipeline) PubSubChannels(pattern string) *ReplyBulkStringArray
- func (b *Pipeline) PubSubNumPat() *ReplyInteger
- func (b *Pipeline) PubSubNumSub(channels ...string) *ReplyInteger
- func (b *Pipeline) Publish(channel, msg string) *ReplyInteger
- func (c *Pipeline) RPop(key string) *ReplyBulkString
- func (c *Pipeline) RPopLPush(src, dest string, timeout time.Duration) *ReplyBulkString
- func (c *Pipeline) RPush(key string, elements ...Arg) *ReplyInteger
- func (c *Pipeline) RPushX(key string, elements ...Arg) *ReplyInteger
- func (b *Pipeline) RandomKey() *ReplyBulkString
- func (b *Pipeline) Rename(key, newkey string) *ReplyOK
- func (b *Pipeline) RenameNX(key, newkey string) *ReplyOK
- func (b *Pipeline) Restore(r Restore) *ReplyOK
- func (b *Pipeline) Set(key, value string, ttl time.Duration) *ReplyOK
- func (b *Pipeline) SetEX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Pipeline) SetNX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Pipeline) SetRange(key string, offset int64, value string) *ReplyBulkString
- func (b *Pipeline) SetXX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Pipeline) Sort(key string, sort Sort) *ReplyBulkStringArray
- func (b *Pipeline) SortStore(dest, key string, sort Sort) *ReplyInteger
- func (b *Pipeline) StrLen(key string) *ReplyBulkString
- func (p *Pipeline) Sync() error
- func (b *Pipeline) TTL(key string) *ReplyInteger
- func (b *Pipeline) Touch(keys ...string) *ReplyInteger
- func (b *Pipeline) Type(key string) *ReplySimpleString
- func (b *Pipeline) Unlink(keys ...string) *ReplyInteger
- func (b *Pipeline) Wait(numReplicas int, timeout time.Duration) *ReplyInteger
- func (b *Pipeline) XAck(key, group string, id string, ids ...string) *ReplyInteger
- func (b *Pipeline) XAdd(key string, maxLen int64, id string, fields ...HArg) *ReplyBulkString
- func (b *Pipeline) XDel(key string, ids ...string) *ReplyInteger
- func (b *Pipeline) XGroupCreate(key, group, id string, makeStream bool) *ReplyOK
- func (b *Pipeline) XGroupDelConsumer(key, group, consumer string) *ReplyInteger
- func (b *Pipeline) XGroupDestroy(key, group string) *ReplyInteger
- func (b *Pipeline) XGroupSetID(key, group, id string) *ReplyOK
- func (b *Pipeline) XInfoConsumers(key, group string) *ReplyXInfoConsumers
- func (b *Pipeline) XInfoGroups(key string) *ReplyXInfoGroups
- func (b *Pipeline) XInfoHelp() *ReplyBulkStringArray
- func (b *Pipeline) XInfoStream(key string) *ReplyXInfoStream
- func (b *Pipeline) XLen(key string) *ReplyInteger
- func (b *Pipeline) XPending(key, group string) *ReplyXPendingSummary
- func (b *Pipeline) XPendingConsumer(args XPending) *ReplyXPending
- func (b *Pipeline) XPendingGroup(args XPending) *ReplyXPending
- func (b *Pipeline) XRange(key, group, start, end string, count int64) *ReplyXRange
- func (b *Pipeline) XRevRange(key, group, end, start string, count int64) *ReplyXRange
- func (b *Pipeline) ZAdd(key string, mode Mode, members ...ZEntry) *ReplyInteger
- func (b *Pipeline) ZAddIncr(key string, mode Mode, member string, d float64) *ReplyFloat
- func (b *Pipeline) ZCard(key string) *ReplyInteger
- func (b *Pipeline) ZCount(key string, min, max Arg) *ReplyInteger
- func (b *Pipeline) ZIncrBy(key string, incr float64, member string) *ReplyFloat
- func (b *Pipeline) ZInterStore(args ZStore) *ReplyInteger
- func (b *Pipeline) ZLexCount(key string, min, max Arg) *ReplyInteger
- func (b *Pipeline) ZPopMax(key string, count int64) *ReplyZRange
- func (b *Pipeline) ZPopMin(key string, count int64) *ReplyZRange
- func (b *Pipeline) ZRange(key string, start, stop int64) *ReplyBulkStringArray
- func (b *Pipeline) ZRangeByLex(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Pipeline) ZRangeByScore(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Pipeline) ZRangeByScoreWithScores(key string, min, max Arg, offset, count int64) *ReplyZRange
- func (b *Pipeline) ZRangeWithScores(key string, start, stop int64) *ReplyZRange
- func (b *Pipeline) ZRank(key, member string) *ReplyInteger
- func (b *Pipeline) ZRem(key string, members ...string) *ReplyInteger
- func (b *Pipeline) ZRemRangeByLex(key string, min, max Arg) *ReplyInteger
- func (b *Pipeline) ZRemRangeByRank(key string, start, stop int64) *ReplyInteger
- func (b *Pipeline) ZRemRangeByScore(key string, min, max Arg) *ReplyInteger
- func (b *Pipeline) ZRevRange(key string, start, stop int64) *ReplyBulkStringArray
- func (b *Pipeline) ZRevRangeByLex(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Pipeline) ZRevRangeByScore(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Pipeline) ZRevRangeByScoreWithScores(key string, max, min Arg, offset, count int64) *ReplyZRange
- func (b *Pipeline) ZRevRangeWithScores(key string, start, stop int64) *ReplyZRange
- func (b *Pipeline) ZRevRank(key, member string) *ReplyInteger
- func (b *Pipeline) ZScore(key, member string) *ReplyFloat
- func (b *Pipeline) ZUnionStore(args ZStore) *ReplyInteger
- type PipelineWriter
- type Pool
- func (p *Pool) Close() error
- func (p *Pool) DoBatch(b *Batch) error
- func (p *Pool) DoCommand(dest interface{}, cmd string, args ...Arg) error
- func (p *Pool) Get() (*Conn, error)
- func (p *Pool) GetDeadline(deadline time.Time) (c *Conn, err error)
- func (p *Pool) GetTimeout(timeout time.Duration) (*Conn, error)
- func (p *Pool) Stats() PoolStats
- type PoolStats
- type Pop
- type PubSubMessage
- type ReplyAny
- type ReplyBool
- type ReplyBulkString
- type ReplyBulkStringArray
- type ReplyFloat
- type ReplyInteger
- type ReplyOK
- type ReplySimpleString
- type ReplyTX
- type ReplyXInfoConsumers
- type ReplyXInfoGroups
- type ReplyXInfoStream
- type ReplyXPending
- type ReplyXPendingSummary
- type ReplyXRange
- type ReplyZPop
- type ReplyZRange
- type Restore
- type Sort
- type SortOrder
- type StreamRecord
- type Subscriber
- func (sub *Subscriber) Block() (*PubSubMessage, error)
- func (sub *Subscriber) Close() (err error)
- func (sub *Subscriber) Get() (*PubSubMessage, error)
- func (sub *Subscriber) Messages() <-chan *PubSubMessage
- func (sub *Subscriber) PSubscribe(patterns ...string) error
- func (sub *Subscriber) PUnsubscribe(patterns ...string) error
- func (sub *Subscriber) Subscribe(channels ...string) error
- func (sub *Subscriber) Unsubscribe(channels ...string) error
- func (sub *Subscriber) Wait(timeout time.Duration) (*PubSubMessage, error)
- type Tx
- func (b *Tx) Append(key, value string) *ReplyBulkString
- func (b *Tx) Decr(key string) *ReplyInteger
- func (b *Tx) DecrBy(key string, d int64) *ReplyInteger
- func (b *Tx) Del(key string, keys ...string) *ReplyInteger
- func (b *Tx) Do(cmd string, args ...Arg) *ReplyAny
- func (b *Tx) Dump(key string) *ReplyBulkString
- func (b *Tx) Exists(keys ...string) *ReplyInteger
- func (b *Tx) Expire(key string, ttl time.Duration) *ReplyInteger
- func (b *Tx) ExpireAt(key string, tm time.Time) *ReplyInteger
- func (b *Tx) FlushDB(async bool) *ReplyOK
- func (b *Tx) Get(key string) *ReplyBulkString
- func (b *Tx) GetRange(key string, start, end int64) *ReplyBulkString
- func (b *Tx) GetSet(key, value string) *ReplyBulkString
- func (b *Tx) HDel(key, field string, fields ...string) *ReplyInteger
- func (b *Tx) HExists(key, field string) *ReplyBool
- func (b *Tx) HGet(key, field string) *ReplyBulkString
- func (b *Tx) HGetAll(key string) *ReplyBulkStringArray
- func (b *Tx) HIncrBy(key, field string, incr int64) *ReplyInteger
- func (b *Tx) HIncrByFloat(key, field string, incr float64) *ReplyFloat
- func (b *Tx) HKeys(key string) *ReplyBulkStringArray
- func (b *Tx) HLen(key string) *ReplyInteger
- func (b *Tx) HMGet(key, field string, fields ...string) *ReplyBulkStringArray
- func (b *Tx) HSet(key, field, value string, entries ...string) *ReplyInteger
- func (b *Tx) HSetArg(key string, field string, value Arg, entries ...HArg) *ReplyInteger
- func (b *Tx) HSetNX(key, field, value string) *ReplyBool
- func (b *Tx) HSetNXArg(key, field string, value Arg) *ReplyBool
- func (b *Tx) HStrLen(key, field string) *ReplyInteger
- func (b *Tx) HVals(key string) *ReplyBulkStringArray
- func (b *Tx) Incr(key string) *ReplyInteger
- func (b *Tx) IncrBy(key string, n int64) *ReplyInteger
- func (b *Tx) IncrByFloat(key string, incr float64) *ReplyFloat
- func (b *Tx) Keys(pattern string) *ReplyBulkStringArray
- func (c *Tx) LIndex(key string, index int64) *ReplyInteger
- func (c *Tx) LInsertAfter(key string, pivot int64, value Arg) *ReplyInteger
- func (c *Tx) LInsertBefore(key string, pivot int64, value Arg) *ReplyInteger
- func (c *Tx) LLen(key string) *ReplyInteger
- func (c *Tx) LPop(key string) *ReplyBulkString
- func (c *Tx) LPush(key string, values ...Arg) *ReplyInteger
- func (c *Tx) LPushX(key string, values ...Arg) *ReplyInteger
- func (c *Tx) LRange(key string, start, stop int64) *ReplyBulkStringArray
- func (c *Tx) LRem(key string, count int64, element Arg) *ReplyInteger
- func (c *Tx) LSet(key string, index int64, element Arg) *ReplyOK
- func (c *Tx) LTrim(key string, start, stop int64) *ReplyInteger
- func (b *Tx) MGet(key string, keys ...string) *ReplyBulkStringArray
- func (b *Tx) MSet(values ...string) *ReplyOK
- func (b *Tx) MSetArg(values map[string]Arg) *ReplyOK
- func (b *Tx) MSetNX(values ...string) *ReplyBool
- func (b *Tx) Migrate(m Migrate) *ReplyOK
- func (b *Tx) Move(key string, db int) *ReplyInteger
- func (b *Tx) ObjectEncoding(key string) *ReplyBulkString
- func (b *Tx) ObjectFreq(key string) *ReplyInteger
- func (b *Tx) ObjectHelp(key string) *ReplyBulkString
- func (b *Tx) ObjectIdleTime(key string) *ReplyInteger
- func (b *Tx) ObjectRefCount(key string) *ReplyInteger
- func (b *Tx) PExpire(key string, ttl time.Duration) *ReplyInteger
- func (b *Tx) PExpireAt(key string, tm time.Time) *ReplyInteger
- func (b *Tx) PTTL(key string) *ReplyInteger
- func (b *Tx) Persist(key string) *ReplyInteger
- func (b Tx) PubSubChannels(pattern string) *ReplyBulkStringArray
- func (b *Tx) PubSubNumPat() *ReplyInteger
- func (b *Tx) PubSubNumSub(channels ...string) *ReplyInteger
- func (b *Tx) Publish(channel, msg string) *ReplyInteger
- func (c *Tx) RPop(key string) *ReplyBulkString
- func (c *Tx) RPopLPush(src, dest string, timeout time.Duration) *ReplyBulkString
- func (c *Tx) RPush(key string, elements ...Arg) *ReplyInteger
- func (c *Tx) RPushX(key string, elements ...Arg) *ReplyInteger
- func (b *Tx) RandomKey() *ReplyBulkString
- func (b *Tx) Rename(key, newkey string) *ReplyOK
- func (b *Tx) RenameNX(key, newkey string) *ReplyOK
- func (b *Tx) Restore(r Restore) *ReplyOK
- func (b *Tx) Set(key, value string, ttl time.Duration) *ReplyOK
- func (b *Tx) SetEX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Tx) SetNX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Tx) SetRange(key string, offset int64, value string) *ReplyBulkString
- func (b *Tx) SetXX(key, value string, ttl time.Duration) *ReplyOK
- func (b *Tx) Sort(key string, sort Sort) *ReplyBulkStringArray
- func (b *Tx) SortStore(dest, key string, sort Sort) *ReplyInteger
- func (b *Tx) StrLen(key string) *ReplyBulkString
- func (b *Tx) TTL(key string) *ReplyInteger
- func (b *Tx) Touch(keys ...string) *ReplyInteger
- func (b *Tx) Type(key string) *ReplySimpleString
- func (b *Tx) Unlink(keys ...string) *ReplyInteger
- func (b *Tx) Wait(numReplicas int, timeout time.Duration) *ReplyInteger
- func (b *Tx) XAck(key, group string, id string, ids ...string) *ReplyInteger
- func (b *Tx) XAdd(key string, maxLen int64, id string, fields ...HArg) *ReplyBulkString
- func (b *Tx) XDel(key string, ids ...string) *ReplyInteger
- func (b *Tx) XGroupCreate(key, group, id string, makeStream bool) *ReplyOK
- func (b *Tx) XGroupDelConsumer(key, group, consumer string) *ReplyInteger
- func (b *Tx) XGroupDestroy(key, group string) *ReplyInteger
- func (b *Tx) XGroupSetID(key, group, id string) *ReplyOK
- func (b *Tx) XInfoConsumers(key, group string) *ReplyXInfoConsumers
- func (b *Tx) XInfoGroups(key string) *ReplyXInfoGroups
- func (b *Tx) XInfoHelp() *ReplyBulkStringArray
- func (b *Tx) XInfoStream(key string) *ReplyXInfoStream
- func (b *Tx) XLen(key string) *ReplyInteger
- func (b *Tx) XPending(key, group string) *ReplyXPendingSummary
- func (b *Tx) XPendingConsumer(args XPending) *ReplyXPending
- func (b *Tx) XPendingGroup(args XPending) *ReplyXPending
- func (b *Tx) XRange(key, group, start, end string, count int64) *ReplyXRange
- func (b *Tx) XRevRange(key, group, end, start string, count int64) *ReplyXRange
- func (b *Tx) ZAdd(key string, mode Mode, members ...ZEntry) *ReplyInteger
- func (b *Tx) ZAddIncr(key string, mode Mode, member string, d float64) *ReplyFloat
- func (b *Tx) ZCard(key string) *ReplyInteger
- func (b *Tx) ZCount(key string, min, max Arg) *ReplyInteger
- func (b *Tx) ZIncrBy(key string, incr float64, member string) *ReplyFloat
- func (b *Tx) ZInterStore(args ZStore) *ReplyInteger
- func (b *Tx) ZLexCount(key string, min, max Arg) *ReplyInteger
- func (b *Tx) ZPopMax(key string, count int64) *ReplyZRange
- func (b *Tx) ZPopMin(key string, count int64) *ReplyZRange
- func (b *Tx) ZRange(key string, start, stop int64) *ReplyBulkStringArray
- func (b *Tx) ZRangeByLex(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Tx) ZRangeByScore(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Tx) ZRangeByScoreWithScores(key string, min, max Arg, offset, count int64) *ReplyZRange
- func (b *Tx) ZRangeWithScores(key string, start, stop int64) *ReplyZRange
- func (b *Tx) ZRank(key, member string) *ReplyInteger
- func (b *Tx) ZRem(key string, members ...string) *ReplyInteger
- func (b *Tx) ZRemRangeByLex(key string, min, max Arg) *ReplyInteger
- func (b *Tx) ZRemRangeByRank(key string, start, stop int64) *ReplyInteger
- func (b *Tx) ZRemRangeByScore(key string, min, max Arg) *ReplyInteger
- func (b *Tx) ZRevRange(key string, start, stop int64) *ReplyBulkStringArray
- func (b *Tx) ZRevRangeByLex(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Tx) ZRevRangeByScore(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
- func (b *Tx) ZRevRangeByScoreWithScores(key string, max, min Arg, offset, count int64) *ReplyZRange
- func (b *Tx) ZRevRangeWithScores(key string, start, stop int64) *ReplyZRange
- func (b *Tx) ZRevRank(key, member string) *ReplyInteger
- func (b *Tx) ZScore(key, member string) *ReplyFloat
- func (b *Tx) ZUnionStore(args ZStore) *ReplyInteger
- type XClaim
- type XInfoConsumer
- type XInfoEntry
- type XInfoGroup
- type XInfoStream
- type XPending
- type XPendingConsumer
- type XPendingEntry
- type XPendingSummary
- type XRange
- type XRead
- type XReadStream
- type ZEntry
- type ZPop
- type ZStore
Constants ¶
const KeepTTL time.Duration = math.MinInt64
KeepTTL sets the SET command's KEEPTTL flag in redis 6
const MaxDBIndex = 16
MaxDBIndex is the max db index allowed by redis.
const StatusOK = resp.SimpleString("OK")
StatusOK is the default success status
const StatusQueued = resp.SimpleString("QUEUED")
StatusQueued is the status of a command in a MULTI/EXEC transaction
Variables ¶
var ErrDiscarded = errors.New("MULTI/EXEC Transaction discarded")
ErrDiscarded is the error of a reply if it's part of a transaction that got discarded
var ( // ErrNoReplies is returned when no more replies are expected on Scan ErrNoReplies = errors.New("No more replies") )
var ErrReplyPending = errors.New("Reply pending")
ErrReplyPending is the error of a reply until a `Client.Sync` is called
Functions ¶
func ReleaseBatch ¶
func ReleaseBatch(b *Batch)
ReleaseBatch releases a Batch to a package-wide pool
Types ¶
type Aggregate ¶
type Aggregate int
Aggregate is an aggregate method
const ( AggregateSum Aggregate AggregateMin AggregateMax )
Aggregate methods
type Arg ¶
type Arg struct {
// contains filtered or unexported fields
}
Arg is a command argument
func Milliseconds ¶
Milliseconds creates an argument converting d to milliseconds
func UnixMilliseconds ¶
UnixMilliseconds creates an argument converting tm to unix ms timestamp
func UnixSeconds ¶
UnixSeconds creates an argument converting tm to unix timestamp
type ArgBuilder ¶
type ArgBuilder struct {
// contains filtered or unexported fields
}
ArgBuilder is an argument builder
func (*ArgBuilder) Args ¶
func (a *ArgBuilder) Args() (args []Arg)
Args returns the current args in a builder
func (*ArgBuilder) Clear ¶
func (a *ArgBuilder) Clear()
Clear resets args to empty and releases strings for GC
func (*ArgBuilder) Field ¶
func (a *ArgBuilder) Field(name string, value Arg)
Field adds a field-value pair
func (*ArgBuilder) Flag ¶
func (a *ArgBuilder) Flag(flag string, ok bool)
Flag adds an optional flag if ok is true
func (*ArgBuilder) Keys ¶
func (a *ArgBuilder) Keys(keys ...string)
Keys adds multiple key arguments
func (*ArgBuilder) KeysUnique ¶
func (a *ArgBuilder) KeysUnique(key string, keys ...string)
func (*ArgBuilder) Milliseconds ¶
func (a *ArgBuilder) Milliseconds(d time.Duration)
Milliseconds adds a duration in ms
func (*ArgBuilder) Option ¶
func (a *ArgBuilder) Option(option, value string)
Option adds an optional argument with a value
func (*ArgBuilder) Score ¶
func (a *ArgBuilder) Score(score float64, include bool)
Score adds a score range argument
func (*ArgBuilder) Seconds ¶
func (a *ArgBuilder) Seconds(d time.Duration)
Seconds adds a duration in sec
func (*ArgBuilder) Strings ¶
func (a *ArgBuilder) Strings(args ...string)
Strings adds multiple string arguments
func (*ArgBuilder) Unique ¶
func (a *ArgBuilder) Unique(arg string, args ...string)
Unique adds multiple string arguments omitting the first argument of args if it's equal to arg
type AssertNonNullArray ¶
type AssertNonNullArray struct{}
AssertNonNullArray checks if a RESP value is a non null array.
func (*AssertNonNullArray) UnmarshalRESP ¶
func (*AssertNonNullArray) UnmarshalRESP(v resp.Value) error
UnmarshalRESP implements resp.Unmarshaler interface
type AssertOK ¶
type AssertOK struct {
Mode Mode
}
AssertOK is a convenience target for `conn.Scan` to check an `OK` reply
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch is a batch of redis commands bound to replies
func AcquireBatch ¶
func AcquireBatch() *Batch
AcquireBatch gets an empty Batch from a package-wide pool
func (*Batch) Append ¶
func (b *Batch) Append(key, value string) *ReplyBulkString
Append appends a string to a value of a key
func (*Batch) DecrBy ¶
func (b *Batch) DecrBy(key string, d int64) *ReplyInteger
DecrBy decrements key by n
func (*Batch) Del ¶
func (b *Batch) Del(key string, keys ...string) *ReplyInteger
Del adds a DEL command to the pipeline
func (*Batch) Exists ¶
func (b *Batch) Exists(keys ...string) *ReplyInteger
Exists is redis EXISTS command
func (*Batch) Expire ¶
func (b *Batch) Expire(key string, ttl time.Duration) *ReplyInteger
Expire is redis EXPIRE command
func (*Batch) ExpireAt ¶
func (b *Batch) ExpireAt(key string, tm time.Time) *ReplyInteger
ExpireAt is redis EXPIREAT command
func (*Batch) Get ¶
func (b *Batch) Get(key string) *ReplyBulkString
Get returns the string value of a key
func (*Batch) GetRange ¶
func (b *Batch) GetRange(key string, start, end int64) *ReplyBulkString
GetRange gets a part of a string
func (*Batch) GetSet ¶
func (b *Batch) GetSet(key, value string) *ReplyBulkString
GetSet atomicaly replaces a value returning the old value
func (*Batch) HDel ¶
func (b *Batch) HDel(key, field string, fields ...string) *ReplyInteger
HDel deletes fields from a map
func (*Batch) HGet ¶
func (b *Batch) HGet(key, field string) *ReplyBulkString
HGet gets a map field value
func (*Batch) HGetAll ¶
func (b *Batch) HGetAll(key string) *ReplyBulkStringArray
HGetAll gets all field/value pairs in a map
func (*Batch) HIncrBy ¶
func (b *Batch) HIncrBy(key, field string, incr int64) *ReplyInteger
HIncrBy increments a field in a map
func (*Batch) HIncrByFloat ¶
func (b *Batch) HIncrByFloat(key, field string, incr float64) *ReplyFloat
HIncrByFloat increments a field in a map by a float value
func (*Batch) HKeys ¶
func (b *Batch) HKeys(key string) *ReplyBulkStringArray
HKeys gets all field keys in a map
func (*Batch) HLen ¶
func (b *Batch) HLen(key string) *ReplyInteger
HLen returns the number of fields in a map
func (*Batch) HMGet ¶
func (b *Batch) HMGet(key, field string, fields ...string) *ReplyBulkStringArray
HMGet returns the values associated with the specified fields in the hash stored at key. For convenience in cases where the fields are already an array the first field is compared to `field`
func (*Batch) HSet ¶
func (b *Batch) HSet(key, field, value string, entries ...string) *ReplyInteger
HSet adds an HSet command to the pipeline
func (*Batch) HSetArg ¶
func (b *Batch) HSetArg(key string, field string, value Arg, entries ...HArg) *ReplyInteger
HSetArg adds an HSet command to the pipeline using Arg
func (*Batch) HStrLen ¶
func (b *Batch) HStrLen(key, field string) *ReplyInteger
HStrLen returns the string length of the value of a field in a map
func (*Batch) HVals ¶
func (b *Batch) HVals(key string) *ReplyBulkStringArray
HVals returns the values of all fields in a map
func (*Batch) IncrBy ¶
func (b *Batch) IncrBy(key string, n int64) *ReplyInteger
IncrBy incremments the value at a key by an integer amount
func (*Batch) IncrByFloat ¶
func (b *Batch) IncrByFloat(key string, incr float64) *ReplyFloat
IncrByFloat incremments the value at a key by a float amount
func (*Batch) Keys ¶
func (b *Batch) Keys(pattern string) *ReplyBulkStringArray
Keys returns all keys matching a pattern
func (*Batch) LIndex ¶
func (c *Batch) LIndex(key string, index int64) *ReplyInteger
LIndex returns the element at index index in the list stored at key.
func (*Batch) LInsertAfter ¶
func (c *Batch) LInsertAfter(key string, pivot int64, value Arg) *ReplyInteger
LInsertAfter inserts element in the list stored at key after the reference value pivot. LINSERT key AFTER pivot element
func (*Batch) LInsertBefore ¶
func (c *Batch) LInsertBefore(key string, pivot int64, value Arg) *ReplyInteger
LInsertBefore inserts element in the list stored at key before the reference value pivot. LINSERT key BEFORE pivot element
func (*Batch) LLen ¶
func (c *Batch) LLen(key string) *ReplyInteger
LLen returns the length of the list stored at key.
func (*Batch) LPop ¶
func (c *Batch) LPop(key string) *ReplyBulkString
LPop removes and returns the first element of the list stored at key.
func (*Batch) LPush ¶
func (c *Batch) LPush(key string, values ...Arg) *ReplyInteger
LPush inserts specified values at the head of the list stored at key.
func (*Batch) LPushX ¶
func (c *Batch) LPushX(key string, values ...Arg) *ReplyInteger
LPushX inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
func (*Batch) LRange ¶
func (c *Batch) LRange(key string, start, stop int64) *ReplyBulkStringArray
LRange returns the specified elements of the list stored at key. LRANGE key start stop
func (*Batch) LRem ¶
func (c *Batch) LRem(key string, count int64, element Arg) *ReplyInteger
LRem removes the first count occurrences of elements equal to element from the list stored at key.
func (*Batch) LTrim ¶
func (c *Batch) LTrim(key string, start, stop int64) *ReplyInteger
LTrim trims an existing list so that it will contain only the specified range of elements specified.
func (*Batch) MGet ¶
func (b *Batch) MGet(key string, keys ...string) *ReplyBulkStringArray
MGet gets multiple key values
func (*Batch) Move ¶
func (b *Batch) Move(key string, db int) *ReplyInteger
Move moves a key to a different DB index
func (*Batch) ObjectEncoding ¶
func (b *Batch) ObjectEncoding(key string) *ReplyBulkString
ObjectEncoding is the redis' OBJECT ENCODING command
func (*Batch) ObjectFreq ¶
func (b *Batch) ObjectFreq(key string) *ReplyInteger
ObjectFreq is the redis' OBJECT FREQ command
func (*Batch) ObjectHelp ¶
func (b *Batch) ObjectHelp(key string) *ReplyBulkString
ObjectHelp is the redis' OBJECT HELP command
func (*Batch) ObjectIdleTime ¶
func (b *Batch) ObjectIdleTime(key string) *ReplyInteger
ObjectIdleTime is the redis' OBJECT IDLETIME command
func (*Batch) ObjectRefCount ¶
func (b *Batch) ObjectRefCount(key string) *ReplyInteger
ObjectRefCount is the redis' OBJECT REFCOUNT command
func (*Batch) PExpire ¶
func (b *Batch) PExpire(key string, ttl time.Duration) *ReplyInteger
PExpire adds a TTL to a key in milliseconds
func (*Batch) PExpireAt ¶
func (b *Batch) PExpireAt(key string, tm time.Time) *ReplyInteger
PExpireAt is redis PEXPIREAT command
func (*Batch) PTTL ¶
func (b *Batch) PTTL(key string) *ReplyInteger
PTTL gets the TTL of a key in milliseconds
func (*Batch) Persist ¶
func (b *Batch) Persist(key string) *ReplyInteger
Persist removes any TTL from a key
func (Batch) PubSubChannels ¶
func (b Batch) PubSubChannels(pattern string) *ReplyBulkStringArray
PubSubChannels lists all active channels. PUBSUB CHANNELS [pattern] If no pattern is specified all channels are listed, otherwise if pattern is specified only channels matching the specified glob-style pattern are listed.
func (*Batch) PubSubNumPat ¶
func (b *Batch) PubSubNumPat() *ReplyInteger
PubSubNumPat returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command). Note that this is not just the count of clients subscribed to patterns but the total number of patterns all the clients are subscribed to. PUBSUB NUMPAT
func (*Batch) PubSubNumSub ¶
func (b *Batch) PubSubNumSub(channels ...string) *ReplyInteger
PubSubNumSub returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels. PUBSUB NUMSUB [channel-1 ... channel-N]
func (*Batch) Publish ¶
func (b *Batch) Publish(channel, msg string) *ReplyInteger
Publish publishes a message on a channel
func (*Batch) RPop ¶
func (c *Batch) RPop(key string) *ReplyBulkString
RPop removes and returns the last element of the list stored at key.
func (*Batch) RPopLPush ¶
func (c *Batch) RPopLPush(src, dest string, timeout time.Duration) *ReplyBulkString
RPopLPush atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.
func (*Batch) RPush ¶
func (c *Batch) RPush(key string, elements ...Arg) *ReplyInteger
RPush inserts specified values at the tail of the list stored at key.
func (*Batch) RPushX ¶
func (c *Batch) RPushX(key string, elements ...Arg) *ReplyInteger
RPushX Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
func (*Batch) RandomKey ¶
func (b *Batch) RandomKey() *ReplyBulkString
RandomKey returns a random key
func (*Batch) SetRange ¶
func (b *Batch) SetRange(key string, offset int64, value string) *ReplyBulkString
SetRange sets a part of a string
func (*Batch) Sort ¶
func (b *Batch) Sort(key string, sort Sort) *ReplyBulkStringArray
Sort sorts a key's values
func (*Batch) SortStore ¶
func (b *Batch) SortStore(dest, key string, sort Sort) *ReplyInteger
SortStore sorts a `key`'s value storing the result in `dest`
func (*Batch) StrLen ¶
func (b *Batch) StrLen(key string) *ReplyBulkString
StrLen return the length of a string value
func (*Batch) TTL ¶
func (b *Batch) TTL(key string) *ReplyInteger
TTL returns the remaining lifetime of a key in seconds
func (*Batch) Touch ¶
func (b *Batch) Touch(keys ...string) *ReplyInteger
Touch alters the last access time of a key(s).
func (*Batch) Type ¶
func (b *Batch) Type(key string) *ReplySimpleString
Type returns the type of the value of a key
func (*Batch) Wait ¶
func (b *Batch) Wait(numReplicas int, timeout time.Duration) *ReplyInteger
Wait blocks until a number of replicas have stored the data or timeout occured
func (*Batch) XAck ¶
func (b *Batch) XAck(key, group string, id string, ids ...string) *ReplyInteger
XAck removes one or multiple messages from the pending entries list (PEL) of a stream consumer group. XACK key group ID [ID ...]
func (*Batch) XAdd ¶
func (b *Batch) XAdd(key string, maxLen int64, id string, fields ...HArg) *ReplyBulkString
XAdd appends the specified stream entry to the stream at the specified key.
XADD key ID field value [field value ...]
If the key does not exist, as a side effect of running this command, the key is created with a stream value.
func (*Batch) XDel ¶
func (b *Batch) XDel(key string, ids ...string) *ReplyInteger
XDel deletes entries from a stream
func (*Batch) XGroupCreate ¶
XGroupCreate creates a new consumer group associated with a stream. XGROUP [CREATE key groupname id-or-$]
func (*Batch) XGroupDelConsumer ¶
func (b *Batch) XGroupDelConsumer(key, group, consumer string) *ReplyInteger
XGroupDelConsumer removes a specific consumer from a consumer group
func (*Batch) XGroupDestroy ¶
func (b *Batch) XGroupDestroy(key, group string) *ReplyInteger
XGroupDestroy destroys a consumer group
func (*Batch) XGroupSetID ¶
XGroupSetID sets the consumer group last delivered ID to something else. XGROUP [SETID key groupname id-or-$]
func (*Batch) XInfoConsumers ¶
func (b *Batch) XInfoConsumers(key, group string) *ReplyXInfoConsumers
XInfoConsumers returns the list of every consumer in a specific consumer group
func (*Batch) XInfoGroups ¶
func (b *Batch) XInfoGroups(key string) *ReplyXInfoGroups
XInfoGroups returns all the consumer groups associated with the stream.
func (*Batch) XInfoHelp ¶
func (b *Batch) XInfoHelp() *ReplyBulkStringArray
XInfoHelp gets help for XINFO command
func (*Batch) XInfoStream ¶
func (b *Batch) XInfoStream(key string) *ReplyXInfoStream
XInfoStream returns general information about the stream stored at the specified key.
func (*Batch) XLen ¶
func (b *Batch) XLen(key string) *ReplyInteger
XLen returns the number of entries inside a stream.
func (*Batch) XPending ¶
func (b *Batch) XPending(key, group string) *ReplyXPendingSummary
func (*Batch) XPendingConsumer ¶
func (b *Batch) XPendingConsumer(args XPending) *ReplyXPending
func (*Batch) XPendingGroup ¶
func (b *Batch) XPendingGroup(args XPending) *ReplyXPending
func (*Batch) XRange ¶
func (b *Batch) XRange(key, group, start, end string, count int64) *ReplyXRange
Command implements Commander interface
func (*Batch) XRevRange ¶
func (b *Batch) XRevRange(key, group, end, start string, count int64) *ReplyXRange
func (*Batch) ZAdd ¶
func (b *Batch) ZAdd(key string, mode Mode, members ...ZEntry) *ReplyInteger
ZAdd adds or modifies the a member of a sorted set
func (*Batch) ZAddIncr ¶
func (b *Batch) ZAddIncr(key string, mode Mode, member string, d float64) *ReplyFloat
ZAddIncr increments the score of a sorted set member by d
func (*Batch) ZCard ¶
func (b *Batch) ZCard(key string) *ReplyInteger
ZCard returns the cardinality of a sorted set
func (*Batch) ZCount ¶
func (b *Batch) ZCount(key string, min, max Arg) *ReplyInteger
ZCount returns the number of elements in the sorted set at key with a score between min and max.
func (*Batch) ZIncrBy ¶
func (b *Batch) ZIncrBy(key string, incr float64, member string) *ReplyFloat
ZIncrBy increments the score of member in the sorted set stored at key by increment.
func (*Batch) ZInterStore ¶
func (b *Batch) ZInterStore(args ZStore) *ReplyInteger
ZInterStore computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.
func (*Batch) ZLexCount ¶
func (b *Batch) ZLexCount(key string, min, max Arg) *ReplyInteger
ZLexCount returns the number of elements in the sorted set at key with a value between min and max.
func (*Batch) ZPopMax ¶
func (b *Batch) ZPopMax(key string, count int64) *ReplyZRange
ZPopMax removes and returns up to count members with the highest scores in the sorted set stored at key.
func (*Batch) ZPopMin ¶
func (b *Batch) ZPopMin(key string, count int64) *ReplyZRange
ZPopMin removes and returns up to count members with the lowest scores in the sorted set stored at key.
func (*Batch) ZRange ¶
func (b *Batch) ZRange(key string, start, stop int64) *ReplyBulkStringArray
ZRange returns the specified range of elements in the sorted set stored at key.
func (*Batch) ZRangeByLex ¶
func (b *Batch) ZRangeByLex(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
ZRangeByLex when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returnWhen 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.s all the elements in the sorted set at key with a value between min and max.
func (*Batch) ZRangeByScore ¶
func (b *Batch) ZRangeByScore(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
ZRangeByScore returns all the elements in the sorted set at key with a score between min and max
func (*Batch) ZRangeByScoreWithScores ¶
func (b *Batch) ZRangeByScoreWithScores(key string, min, max Arg, offset, count int64) *ReplyZRange
ZRangeByScoreWithScores returns all the elements in the sorted set at key with a score between min and max
func (*Batch) ZRangeWithScores ¶
func (b *Batch) ZRangeWithScores(key string, start, stop int64) *ReplyZRange
ZRangeWithScores returns the specified range of elements in the sorted set stored at key.
func (*Batch) ZRank ¶
func (b *Batch) ZRank(key, member string) *ReplyInteger
ZRank gets the rank of a member of a sorted set ordered from low to high
func (*Batch) ZRem ¶
func (b *Batch) ZRem(key string, members ...string) *ReplyInteger
ZRem removes member(s) from a sorted set
func (*Batch) ZRemRangeByLex ¶
func (b *Batch) ZRemRangeByLex(key string, min, max Arg) *ReplyInteger
ZRemRangeByLex removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.
func (*Batch) ZRemRangeByRank ¶
func (b *Batch) ZRemRangeByRank(key string, start, stop int64) *ReplyInteger
ZRemRangeByRank removes all elements in the sorted set stored at key with rank between start and stop.
func (*Batch) ZRemRangeByScore ¶
func (b *Batch) ZRemRangeByScore(key string, min, max Arg) *ReplyInteger
ZRemRangeByScore removes all elements in the sorted set stored at key with a score between min and max (inclusive).
func (*Batch) ZRevRange ¶
func (b *Batch) ZRevRange(key string, start, stop int64) *ReplyBulkStringArray
ZRevRange returns the specified range of elements in the sorted set stored at key.
func (*Batch) ZRevRangeByLex ¶
func (b *Batch) ZRevRangeByLex(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
ZRevRangeByLex when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returnWhen 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.s all the elements in the sorted set at key with a value between min and max.
func (*Batch) ZRevRangeByScore ¶
func (b *Batch) ZRevRangeByScore(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
ZRevRangeByScore returns all the elements in the sorted set at key with a score between min and max
func (*Batch) ZRevRangeByScoreWithScores ¶
func (b *Batch) ZRevRangeByScoreWithScores(key string, max, min Arg, offset, count int64) *ReplyZRange
ZRevRangeByScoreWithScores returns all the elements in the sorted set at key with a score between min and max
func (*Batch) ZRevRangeWithScores ¶
func (b *Batch) ZRevRangeWithScores(key string, start, stop int64) *ReplyZRange
ZRevRangeWithScores returns the specified range of elements in the sorted set stored at key.
func (*Batch) ZRevRank ¶
func (b *Batch) ZRevRank(key, member string) *ReplyInteger
ZRevRank gets the rank of a member of a sorted set ordered from high to low
func (*Batch) ZScore ¶
func (b *Batch) ZScore(key, member string) *ReplyFloat
ZScore returns the score of a member
func (*Batch) ZUnionStore ¶
func (b *Batch) ZUnionStore(args ZStore) *ReplyInteger
ZUnionStore computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination.
type CommandBuilder ¶
type CommandBuilder interface {
BuildCommand(args *ArgBuilder) string
}
CommandBuilder builds a redis command
type CommandWriter ¶
CommandWriter writes a redis command
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a redis client connection
func Dial ¶
func Dial(addr string, options *ConnOptions) (*Conn, error)
Dial opens a connection to a redis server
func WrapConn ¶
func WrapConn(conn net.Conn, options *ConnOptions) (*Conn, error)
WrapConn wraps a net.Conn in a redis connection
func (*Conn) BRPopLPush ¶
BRPopLPush is the blocking variant of RPopLPush
func (*Conn) LoadScript ¶
LoadScript loads a Lua script
func (*Conn) Reset ¶
func (conn *Conn) Reset(options *ConnOptions) error
Reset resets the connection to a state as defined by the options
func (*Conn) Scan ¶
Scan decodes a reply to dest If so keep the deadline(?) so an appropriate timeout is set next time XXX (see below) Other solution: return an error on write if a blocking command skips the reply Edit: This is nuts, the timeout is on the server. Since we are writing the command in a pipeline we cannot know when the server will set the timeout It's plain and simple to only allow blocking commands on a `clean` connection and handle the timeouts appropriately there. XXX (see below) OTOH it's plausible that a blocking command could be the last step in a MULTI/EXEC transaction Edit: From testing via redis-cli it seems that the server does *NOT* respect the timeout when a blocking command is inside MULTI/EXEC block It executes the pop immediately if a value is available or return a nil response Edit: This is also the case for client reply skip followed by BLPOP... Edit: CLIENT REPLY SKIP and blocking commands don't mix well If an error occurs because the command was wrong nothing is returned Otherwise the SKIP is ignored and does *NOT* carry over to the next command Because of all these intricacies the best thing to do is to a) disallow client reply subcommand entirely and only use it internally - DONE b) ignore the timeout of blocking commands when queued - DONE c) maybe change the way timeout is stored in an `cmd.Entry`
so that it stores the deadline when it is written to the pipeline This is not urgent as setting a lax deadline is not so harmful if the connection is healthy
func (*Conn) Subscriber ¶
func (conn *Conn) Subscriber(queueSize int) (*Subscriber, error)
Subscriber enables pub/sub subscriber mode for a connection
func (*Conn) WriteCommand ¶
WriteCommand writes a redis command to the pipeline buffer updating the state
type ConnOptions ¶
type ConnOptions struct { ReadBufferSize int // Size of the read buffer WriteBufferSize int // Size of the write buffer ReadTimeout time.Duration // If > 0 all reads will fail if exceeded WriteTimeout time.Duration // If > 0 all writes will fail if exceeded WriteOnly bool // WriteOnly connections return no replies DB int // Redis DB index KeyPrefix string // Prefix all keys Auth string // Redis auth Debug bool // Disables script injection }
ConnOptions holds connection options
type Migrate ¶
type Migrate struct { Host string Port int DestinasionDB int Timeout time.Duration Copy bool Replace bool Auth string Keys []string }
Migrate moves data across servers
type Mode ¶
type Mode uint
Mode defines command modes NX/XX
const ( NX Mode XX CH INCR EX PX )
Execution modes
type Pipeline ¶
type Pipeline struct { Batch // contains filtered or unexported fields }
Pipeline is a connection manager for easy pipelining
func (*Pipeline) Append ¶
func (b *Pipeline) Append(key, value string) *ReplyBulkString
Append appends a string to a value of a key
func (*Pipeline) DecrBy ¶
func (b *Pipeline) DecrBy(key string, d int64) *ReplyInteger
DecrBy decrements key by n
func (*Pipeline) Del ¶
func (b *Pipeline) Del(key string, keys ...string) *ReplyInteger
Del adds a DEL command to the pipeline
func (*Pipeline) Dump ¶
func (b *Pipeline) Dump(key string) *ReplyBulkString
Dump adds a DUMP command
func (*Pipeline) Exists ¶
func (b *Pipeline) Exists(keys ...string) *ReplyInteger
Exists is redis EXISTS command
func (*Pipeline) Expire ¶
func (b *Pipeline) Expire(key string, ttl time.Duration) *ReplyInteger
Expire is redis EXPIRE command
func (*Pipeline) ExpireAt ¶
func (b *Pipeline) ExpireAt(key string, tm time.Time) *ReplyInteger
ExpireAt is redis EXPIREAT command
func (*Pipeline) Get ¶
func (b *Pipeline) Get(key string) *ReplyBulkString
Get returns the string value of a key
func (*Pipeline) GetRange ¶
func (b *Pipeline) GetRange(key string, start, end int64) *ReplyBulkString
GetRange gets a part of a string
func (*Pipeline) GetSet ¶
func (b *Pipeline) GetSet(key, value string) *ReplyBulkString
GetSet atomicaly replaces a value returning the old value
func (*Pipeline) HDel ¶
func (b *Pipeline) HDel(key, field string, fields ...string) *ReplyInteger
HDel deletes fields from a map
func (*Pipeline) HGet ¶
func (b *Pipeline) HGet(key, field string) *ReplyBulkString
HGet gets a map field value
func (*Pipeline) HGetAll ¶
func (b *Pipeline) HGetAll(key string) *ReplyBulkStringArray
HGetAll gets all field/value pairs in a map
func (*Pipeline) HIncrBy ¶
func (b *Pipeline) HIncrBy(key, field string, incr int64) *ReplyInteger
HIncrBy increments a field in a map
func (*Pipeline) HIncrByFloat ¶
func (b *Pipeline) HIncrByFloat(key, field string, incr float64) *ReplyFloat
HIncrByFloat increments a field in a map by a float value
func (*Pipeline) HKeys ¶
func (b *Pipeline) HKeys(key string) *ReplyBulkStringArray
HKeys gets all field keys in a map
func (*Pipeline) HLen ¶
func (b *Pipeline) HLen(key string) *ReplyInteger
HLen returns the number of fields in a map
func (*Pipeline) HMGet ¶
func (b *Pipeline) HMGet(key, field string, fields ...string) *ReplyBulkStringArray
HMGet returns the values associated with the specified fields in the hash stored at key. For convenience in cases where the fields are already an array the first field is compared to `field`
func (*Pipeline) HSet ¶
func (b *Pipeline) HSet(key, field, value string, entries ...string) *ReplyInteger
HSet adds an HSet command to the pipeline
func (*Pipeline) HSetArg ¶
func (b *Pipeline) HSetArg(key string, field string, value Arg, entries ...HArg) *ReplyInteger
HSetArg adds an HSet command to the pipeline using Arg
func (*Pipeline) HStrLen ¶
func (b *Pipeline) HStrLen(key, field string) *ReplyInteger
HStrLen returns the string length of the value of a field in a map
func (*Pipeline) HVals ¶
func (b *Pipeline) HVals(key string) *ReplyBulkStringArray
HVals returns the values of all fields in a map
func (*Pipeline) IncrBy ¶
func (b *Pipeline) IncrBy(key string, n int64) *ReplyInteger
IncrBy incremments the value at a key by an integer amount
func (*Pipeline) IncrByFloat ¶
func (b *Pipeline) IncrByFloat(key string, incr float64) *ReplyFloat
IncrByFloat incremments the value at a key by a float amount
func (*Pipeline) Keys ¶
func (b *Pipeline) Keys(pattern string) *ReplyBulkStringArray
Keys returns all keys matching a pattern
func (*Pipeline) LIndex ¶
func (c *Pipeline) LIndex(key string, index int64) *ReplyInteger
LIndex returns the element at index index in the list stored at key.
func (*Pipeline) LInsertAfter ¶
func (c *Pipeline) LInsertAfter(key string, pivot int64, value Arg) *ReplyInteger
LInsertAfter inserts element in the list stored at key after the reference value pivot. LINSERT key AFTER pivot element
func (*Pipeline) LInsertBefore ¶
func (c *Pipeline) LInsertBefore(key string, pivot int64, value Arg) *ReplyInteger
LInsertBefore inserts element in the list stored at key before the reference value pivot. LINSERT key BEFORE pivot element
func (*Pipeline) LLen ¶
func (c *Pipeline) LLen(key string) *ReplyInteger
LLen returns the length of the list stored at key.
func (*Pipeline) LPop ¶
func (c *Pipeline) LPop(key string) *ReplyBulkString
LPop removes and returns the first element of the list stored at key.
func (*Pipeline) LPush ¶
func (c *Pipeline) LPush(key string, values ...Arg) *ReplyInteger
LPush inserts specified values at the head of the list stored at key.
func (*Pipeline) LPushX ¶
func (c *Pipeline) LPushX(key string, values ...Arg) *ReplyInteger
LPushX inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
func (*Pipeline) LRange ¶
func (c *Pipeline) LRange(key string, start, stop int64) *ReplyBulkStringArray
LRange returns the specified elements of the list stored at key. LRANGE key start stop
func (*Pipeline) LRem ¶
func (c *Pipeline) LRem(key string, count int64, element Arg) *ReplyInteger
LRem removes the first count occurrences of elements equal to element from the list stored at key.
func (*Pipeline) LTrim ¶
func (c *Pipeline) LTrim(key string, start, stop int64) *ReplyInteger
LTrim trims an existing list so that it will contain only the specified range of elements specified.
func (*Pipeline) MGet ¶
func (b *Pipeline) MGet(key string, keys ...string) *ReplyBulkStringArray
MGet gets multiple key values
func (*Pipeline) Move ¶
func (b *Pipeline) Move(key string, db int) *ReplyInteger
Move moves a key to a different DB index
func (*Pipeline) ObjectEncoding ¶
func (b *Pipeline) ObjectEncoding(key string) *ReplyBulkString
ObjectEncoding is the redis' OBJECT ENCODING command
func (*Pipeline) ObjectFreq ¶
func (b *Pipeline) ObjectFreq(key string) *ReplyInteger
ObjectFreq is the redis' OBJECT FREQ command
func (*Pipeline) ObjectHelp ¶
func (b *Pipeline) ObjectHelp(key string) *ReplyBulkString
ObjectHelp is the redis' OBJECT HELP command
func (*Pipeline) ObjectIdleTime ¶
func (b *Pipeline) ObjectIdleTime(key string) *ReplyInteger
ObjectIdleTime is the redis' OBJECT IDLETIME command
func (*Pipeline) ObjectRefCount ¶
func (b *Pipeline) ObjectRefCount(key string) *ReplyInteger
ObjectRefCount is the redis' OBJECT REFCOUNT command
func (*Pipeline) PExpire ¶
func (b *Pipeline) PExpire(key string, ttl time.Duration) *ReplyInteger
PExpire adds a TTL to a key in milliseconds
func (*Pipeline) PExpireAt ¶
func (b *Pipeline) PExpireAt(key string, tm time.Time) *ReplyInteger
PExpireAt is redis PEXPIREAT command
func (*Pipeline) PTTL ¶
func (b *Pipeline) PTTL(key string) *ReplyInteger
PTTL gets the TTL of a key in milliseconds
func (*Pipeline) Persist ¶
func (b *Pipeline) Persist(key string) *ReplyInteger
Persist removes any TTL from a key
func (Pipeline) PubSubChannels ¶
func (b Pipeline) PubSubChannels(pattern string) *ReplyBulkStringArray
PubSubChannels lists all active channels. PUBSUB CHANNELS [pattern] If no pattern is specified all channels are listed, otherwise if pattern is specified only channels matching the specified glob-style pattern are listed.
func (*Pipeline) PubSubNumPat ¶
func (b *Pipeline) PubSubNumPat() *ReplyInteger
PubSubNumPat returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command). Note that this is not just the count of clients subscribed to patterns but the total number of patterns all the clients are subscribed to. PUBSUB NUMPAT
func (*Pipeline) PubSubNumSub ¶
func (b *Pipeline) PubSubNumSub(channels ...string) *ReplyInteger
PubSubNumSub returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels. PUBSUB NUMSUB [channel-1 ... channel-N]
func (*Pipeline) Publish ¶
func (b *Pipeline) Publish(channel, msg string) *ReplyInteger
Publish publishes a message on a channel
func (*Pipeline) RPop ¶
func (c *Pipeline) RPop(key string) *ReplyBulkString
RPop removes and returns the last element of the list stored at key.
func (*Pipeline) RPopLPush ¶
func (c *Pipeline) RPopLPush(src, dest string, timeout time.Duration) *ReplyBulkString
RPopLPush atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.
func (*Pipeline) RPush ¶
func (c *Pipeline) RPush(key string, elements ...Arg) *ReplyInteger
RPush inserts specified values at the tail of the list stored at key.
func (*Pipeline) RPushX ¶
func (c *Pipeline) RPushX(key string, elements ...Arg) *ReplyInteger
RPushX Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
func (*Pipeline) RandomKey ¶
func (b *Pipeline) RandomKey() *ReplyBulkString
RandomKey returns a random key
func (*Pipeline) SetRange ¶
func (b *Pipeline) SetRange(key string, offset int64, value string) *ReplyBulkString
SetRange sets a part of a string
func (*Pipeline) Sort ¶
func (b *Pipeline) Sort(key string, sort Sort) *ReplyBulkStringArray
Sort sorts a key's values
func (*Pipeline) SortStore ¶
func (b *Pipeline) SortStore(dest, key string, sort Sort) *ReplyInteger
SortStore sorts a `key`'s value storing the result in `dest`
func (*Pipeline) StrLen ¶
func (b *Pipeline) StrLen(key string) *ReplyBulkString
StrLen return the length of a string value
func (*Pipeline) TTL ¶
func (b *Pipeline) TTL(key string) *ReplyInteger
TTL returns the remaining lifetime of a key in seconds
func (*Pipeline) Touch ¶
func (b *Pipeline) Touch(keys ...string) *ReplyInteger
Touch alters the last access time of a key(s).
func (*Pipeline) Type ¶
func (b *Pipeline) Type(key string) *ReplySimpleString
Type returns the type of the value of a key
func (*Pipeline) Wait ¶
func (b *Pipeline) Wait(numReplicas int, timeout time.Duration) *ReplyInteger
Wait blocks until a number of replicas have stored the data or timeout occured
func (*Pipeline) XAck ¶
func (b *Pipeline) XAck(key, group string, id string, ids ...string) *ReplyInteger
XAck removes one or multiple messages from the pending entries list (PEL) of a stream consumer group. XACK key group ID [ID ...]
func (*Pipeline) XAdd ¶
func (b *Pipeline) XAdd(key string, maxLen int64, id string, fields ...HArg) *ReplyBulkString
XAdd appends the specified stream entry to the stream at the specified key.
XADD key ID field value [field value ...]
If the key does not exist, as a side effect of running this command, the key is created with a stream value.
func (*Pipeline) XDel ¶
func (b *Pipeline) XDel(key string, ids ...string) *ReplyInteger
XDel deletes entries from a stream
func (*Pipeline) XGroupCreate ¶
XGroupCreate creates a new consumer group associated with a stream. XGROUP [CREATE key groupname id-or-$]
func (*Pipeline) XGroupDelConsumer ¶
func (b *Pipeline) XGroupDelConsumer(key, group, consumer string) *ReplyInteger
XGroupDelConsumer removes a specific consumer from a consumer group
func (*Pipeline) XGroupDestroy ¶
func (b *Pipeline) XGroupDestroy(key, group string) *ReplyInteger
XGroupDestroy destroys a consumer group
func (*Pipeline) XGroupSetID ¶
XGroupSetID sets the consumer group last delivered ID to something else. XGROUP [SETID key groupname id-or-$]
func (*Pipeline) XInfoConsumers ¶
func (b *Pipeline) XInfoConsumers(key, group string) *ReplyXInfoConsumers
XInfoConsumers returns the list of every consumer in a specific consumer group
func (*Pipeline) XInfoGroups ¶
func (b *Pipeline) XInfoGroups(key string) *ReplyXInfoGroups
XInfoGroups returns all the consumer groups associated with the stream.
func (*Pipeline) XInfoHelp ¶
func (b *Pipeline) XInfoHelp() *ReplyBulkStringArray
XInfoHelp gets help for XINFO command
func (*Pipeline) XInfoStream ¶
func (b *Pipeline) XInfoStream(key string) *ReplyXInfoStream
XInfoStream returns general information about the stream stored at the specified key.
func (*Pipeline) XLen ¶
func (b *Pipeline) XLen(key string) *ReplyInteger
XLen returns the number of entries inside a stream.
func (*Pipeline) XPending ¶
func (b *Pipeline) XPending(key, group string) *ReplyXPendingSummary
func (*Pipeline) XPendingConsumer ¶
func (b *Pipeline) XPendingConsumer(args XPending) *ReplyXPending
func (*Pipeline) XPendingGroup ¶
func (b *Pipeline) XPendingGroup(args XPending) *ReplyXPending
func (*Pipeline) XRange ¶
func (b *Pipeline) XRange(key, group, start, end string, count int64) *ReplyXRange
Command implements Commander interface
func (*Pipeline) XRevRange ¶
func (b *Pipeline) XRevRange(key, group, end, start string, count int64) *ReplyXRange
func (*Pipeline) ZAdd ¶
func (b *Pipeline) ZAdd(key string, mode Mode, members ...ZEntry) *ReplyInteger
ZAdd adds or modifies the a member of a sorted set
func (*Pipeline) ZAddIncr ¶
func (b *Pipeline) ZAddIncr(key string, mode Mode, member string, d float64) *ReplyFloat
ZAddIncr increments the score of a sorted set member by d
func (*Pipeline) ZCard ¶
func (b *Pipeline) ZCard(key string) *ReplyInteger
ZCard returns the cardinality of a sorted set
func (*Pipeline) ZCount ¶
func (b *Pipeline) ZCount(key string, min, max Arg) *ReplyInteger
ZCount returns the number of elements in the sorted set at key with a score between min and max.
func (*Pipeline) ZIncrBy ¶
func (b *Pipeline) ZIncrBy(key string, incr float64, member string) *ReplyFloat
ZIncrBy increments the score of member in the sorted set stored at key by increment.
func (*Pipeline) ZInterStore ¶
func (b *Pipeline) ZInterStore(args ZStore) *ReplyInteger
ZInterStore computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.
func (*Pipeline) ZLexCount ¶
func (b *Pipeline) ZLexCount(key string, min, max Arg) *ReplyInteger
ZLexCount returns the number of elements in the sorted set at key with a value between min and max.
func (*Pipeline) ZPopMax ¶
func (b *Pipeline) ZPopMax(key string, count int64) *ReplyZRange
ZPopMax removes and returns up to count members with the highest scores in the sorted set stored at key.
func (*Pipeline) ZPopMin ¶
func (b *Pipeline) ZPopMin(key string, count int64) *ReplyZRange
ZPopMin removes and returns up to count members with the lowest scores in the sorted set stored at key.
func (*Pipeline) ZRange ¶
func (b *Pipeline) ZRange(key string, start, stop int64) *ReplyBulkStringArray
ZRange returns the specified range of elements in the sorted set stored at key.
func (*Pipeline) ZRangeByLex ¶
func (b *Pipeline) ZRangeByLex(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
ZRangeByLex when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returnWhen 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.s all the elements in the sorted set at key with a value between min and max.
func (*Pipeline) ZRangeByScore ¶
func (b *Pipeline) ZRangeByScore(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
ZRangeByScore returns all the elements in the sorted set at key with a score between min and max
func (*Pipeline) ZRangeByScoreWithScores ¶
func (b *Pipeline) ZRangeByScoreWithScores(key string, min, max Arg, offset, count int64) *ReplyZRange
ZRangeByScoreWithScores returns all the elements in the sorted set at key with a score between min and max
func (*Pipeline) ZRangeWithScores ¶
func (b *Pipeline) ZRangeWithScores(key string, start, stop int64) *ReplyZRange
ZRangeWithScores returns the specified range of elements in the sorted set stored at key.
func (*Pipeline) ZRank ¶
func (b *Pipeline) ZRank(key, member string) *ReplyInteger
ZRank gets the rank of a member of a sorted set ordered from low to high
func (*Pipeline) ZRem ¶
func (b *Pipeline) ZRem(key string, members ...string) *ReplyInteger
ZRem removes member(s) from a sorted set
func (*Pipeline) ZRemRangeByLex ¶
func (b *Pipeline) ZRemRangeByLex(key string, min, max Arg) *ReplyInteger
ZRemRangeByLex removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.
func (*Pipeline) ZRemRangeByRank ¶
func (b *Pipeline) ZRemRangeByRank(key string, start, stop int64) *ReplyInteger
ZRemRangeByRank removes all elements in the sorted set stored at key with rank between start and stop.
func (*Pipeline) ZRemRangeByScore ¶
func (b *Pipeline) ZRemRangeByScore(key string, min, max Arg) *ReplyInteger
ZRemRangeByScore removes all elements in the sorted set stored at key with a score between min and max (inclusive).
func (*Pipeline) ZRevRange ¶
func (b *Pipeline) ZRevRange(key string, start, stop int64) *ReplyBulkStringArray
ZRevRange returns the specified range of elements in the sorted set stored at key.
func (*Pipeline) ZRevRangeByLex ¶
func (b *Pipeline) ZRevRangeByLex(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
ZRevRangeByLex when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returnWhen 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.s all the elements in the sorted set at key with a value between min and max.
func (*Pipeline) ZRevRangeByScore ¶
func (b *Pipeline) ZRevRangeByScore(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
ZRevRangeByScore returns all the elements in the sorted set at key with a score between min and max
func (*Pipeline) ZRevRangeByScoreWithScores ¶
func (b *Pipeline) ZRevRangeByScoreWithScores(key string, max, min Arg, offset, count int64) *ReplyZRange
ZRevRangeByScoreWithScores returns all the elements in the sorted set at key with a score between min and max
func (*Pipeline) ZRevRangeWithScores ¶
func (b *Pipeline) ZRevRangeWithScores(key string, start, stop int64) *ReplyZRange
ZRevRangeWithScores returns the specified range of elements in the sorted set stored at key.
func (*Pipeline) ZRevRank ¶
func (b *Pipeline) ZRevRank(key, member string) *ReplyInteger
ZRevRank gets the rank of a member of a sorted set ordered from high to low
func (*Pipeline) ZScore ¶
func (b *Pipeline) ZScore(key, member string) *ReplyFloat
ZScore returns the score of a member
func (*Pipeline) ZUnionStore ¶
func (b *Pipeline) ZUnionStore(args ZStore) *ReplyInteger
ZUnionStore computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination.
type PipelineWriter ¶
type PipelineWriter struct { KeyPrefix string // contains filtered or unexported fields }
func (*PipelineWriter) Flush ¶
func (w *PipelineWriter) Flush() error
Flush flushes the underlying writer
func (*PipelineWriter) Reset ¶
func (w *PipelineWriter) Reset(dest *bufio.Writer)
func (*PipelineWriter) WriteCommand ¶
func (w *PipelineWriter) WriteCommand(cmd string, args ...Arg) (err error)
WriteCommand writes a redis command
type Pool ¶
type Pool struct { Dial func() (*Conn, error) // Dialer for redis connections (required) MaxConnections int // Maximum number of connection to open on demand (defaults to 1) MinConnections int // Minimum number of connections to keep open once dialed (defaults to 1) MaxIdleTime time.Duration // Max time a connection will be left idling (0 => no limit) ClockInterval time.Duration // Minimum unit of time for timeouts and intervals (defaults to 50ms) // contains filtered or unexported fields }
Pool is a pool of redis connections
func (*Pool) Close ¶
Close closes a pool and all it's connections TODO: [pool] Implement grace period for when closing a pool
func (*Pool) Get ¶
Get waits indefinitely to get a connection from the pool
To release the connection back to the pool use `Pool.Put(*Conn)`
func (*Pool) GetDeadline ¶
GetDeadline waits until deadline for a connection
func (*Pool) GetTimeout ¶
GetTimeout waits `timeout` to get a connection from the pool
To release the connection back to the pool use `Pool.Put(*Conn)`
type PubSubMessage ¶
PubSubMessage is a message from a PUB/SUB channel
type ReplyAny ¶
type ReplyAny struct {
// contains filtered or unexported fields
}
ReplyAny is a redis reply of any kind
type ReplyBool ¶
type ReplyBool struct {
// contains filtered or unexported fields
}
ReplyBool is a redis integer reply with values 1 or 0
type ReplyBulkString ¶
type ReplyBulkString struct {
// contains filtered or unexported fields
}
ReplyBulkString is a single bulk string reply
func (*ReplyBulkString) Reply ¶
func (r *ReplyBulkString) Reply() (string, error)
Reply returns the bulk string
type ReplyBulkStringArray ¶
type ReplyBulkStringArray struct {
// contains filtered or unexported fields
}
ReplyBulkStringArray is a redis array reply with non-null bulk string elements
func (*ReplyBulkStringArray) Reply ¶
func (r *ReplyBulkStringArray) Reply() ([]string, error)
Reply returns the strings reply
type ReplyFloat ¶
type ReplyFloat struct {
// contains filtered or unexported fields
}
ReplyFloat is a redis bulk string reply that is parsed as a float
func (*ReplyFloat) Reply ¶
func (r *ReplyFloat) Reply() (float64, error)
Reply returns the float value
type ReplyInteger ¶
type ReplyInteger struct {
// contains filtered or unexported fields
}
ReplyInteger is a redis integer reply
func (*ReplyInteger) Reply ¶
func (r *ReplyInteger) Reply() (int64, error)
Reply returns the integer value
type ReplyOK ¶
type ReplyOK struct {
// contains filtered or unexported fields
}
ReplyOK is a redis "OK" status reply
type ReplySimpleString ¶
type ReplySimpleString struct {
// contains filtered or unexported fields
}
ReplySimpleString is a redis status reply
func (*ReplySimpleString) Reply ¶
func (r *ReplySimpleString) Reply() (string, error)
Reply returns the status reply
type ReplyTX ¶
type ReplyTX struct {
// contains filtered or unexported fields
}
ReplyTX is the reply from a MULTI/EXEC transaction
type ReplyXInfoConsumers ¶
type ReplyXInfoConsumers struct {
// contains filtered or unexported fields
}
func (*ReplyXInfoConsumers) Reply ¶
func (r *ReplyXInfoConsumers) Reply() ([]XInfoConsumer, error)
type ReplyXInfoGroups ¶
type ReplyXInfoGroups struct {
// contains filtered or unexported fields
}
func (*ReplyXInfoGroups) Reply ¶
func (r *ReplyXInfoGroups) Reply() ([]XInfoGroup, error)
type ReplyXInfoStream ¶
type ReplyXInfoStream struct {
// contains filtered or unexported fields
}
func (*ReplyXInfoStream) Reply ¶
func (r *ReplyXInfoStream) Reply() (XInfoStream, error)
type ReplyXPending ¶
type ReplyXPending struct {
// contains filtered or unexported fields
}
func (*ReplyXPending) Reply ¶
func (r *ReplyXPending) Reply() ([]XPendingEntry, error)
type ReplyXPendingSummary ¶
type ReplyXPendingSummary struct {
// contains filtered or unexported fields
}
func (*ReplyXPendingSummary) Reply ¶
func (r *ReplyXPendingSummary) Reply() (XPendingSummary, error)
type ReplyXRange ¶
type ReplyXRange struct {
// contains filtered or unexported fields
}
func (*ReplyXRange) Reply ¶
func (r *ReplyXRange) Reply() ([]StreamRecord, error)
type ReplyZPop ¶
type ReplyZPop struct {
// contains filtered or unexported fields
}
ReplyZPop is the reply of a BZPOPMIN/BZPOPMAX command
type ReplyZRange ¶
type ReplyZRange struct {
// contains filtered or unexported fields
}
ReplyZRange is a map of members with scores
type Restore ¶
type Restore struct { Key string TTL time.Duration Value string Replace bool AbsoluteTTL bool IdleTime time.Duration Frequency int64 }
Restore restores a key value from a string
type Sort ¶
type Sort struct { By string Offset int64 Count int64 Get []string Order SortOrder Alphanumeric bool }
Sort sorts keys
type SortOrder ¶
type SortOrder int
SortOrder defines sorting order
const ( SortAscending SortOrder SortDescending )
Sort orders ASC=1, DESC=2
type StreamRecord ¶
func (*StreamRecord) UnmarshalRESP ¶
func (s *StreamRecord) UnmarshalRESP(v resp.Value) error
UnmarshalRESP implements resp.Unmarshaler interface
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber subscribes to redis PUB/SUB channels
func (*Subscriber) Block ¶
func (sub *Subscriber) Block() (*PubSubMessage, error)
Block waits forever for a message
func (*Subscriber) Get ¶
func (sub *Subscriber) Get() (*PubSubMessage, error)
Get waits timeout for a message
func (*Subscriber) Messages ¶
func (sub *Subscriber) Messages() <-chan *PubSubMessage
Messages returns a channel of incoming PUB/SUB messages
func (*Subscriber) PSubscribe ¶
func (sub *Subscriber) PSubscribe(patterns ...string) error
PSubscribe subscribes to channels matching patterns
func (*Subscriber) PUnsubscribe ¶
func (sub *Subscriber) PUnsubscribe(patterns ...string) error
PUnsubscribe unsubscribes from channels matching pattenrs
func (*Subscriber) Subscribe ¶
func (sub *Subscriber) Subscribe(channels ...string) error
Subscribe subscribes to channels
func (*Subscriber) Unsubscribe ¶
func (sub *Subscriber) Unsubscribe(channels ...string) error
Unsubscribe unsubscribes from channels
func (*Subscriber) Wait ¶
func (sub *Subscriber) Wait(timeout time.Duration) (*PubSubMessage, error)
Wait waits `timeout` for a message
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a MULTI/EXEC transaction block
func (*Tx) Append ¶
func (b *Tx) Append(key, value string) *ReplyBulkString
Append appends a string to a value of a key
func (*Tx) DecrBy ¶
func (b *Tx) DecrBy(key string, d int64) *ReplyInteger
DecrBy decrements key by n
func (*Tx) Del ¶
func (b *Tx) Del(key string, keys ...string) *ReplyInteger
Del adds a DEL command to the pipeline
func (*Tx) Exists ¶
func (b *Tx) Exists(keys ...string) *ReplyInteger
Exists is redis EXISTS command
func (*Tx) Expire ¶
func (b *Tx) Expire(key string, ttl time.Duration) *ReplyInteger
Expire is redis EXPIRE command
func (*Tx) ExpireAt ¶
func (b *Tx) ExpireAt(key string, tm time.Time) *ReplyInteger
ExpireAt is redis EXPIREAT command
func (*Tx) Get ¶
func (b *Tx) Get(key string) *ReplyBulkString
Get returns the string value of a key
func (*Tx) GetRange ¶
func (b *Tx) GetRange(key string, start, end int64) *ReplyBulkString
GetRange gets a part of a string
func (*Tx) GetSet ¶
func (b *Tx) GetSet(key, value string) *ReplyBulkString
GetSet atomicaly replaces a value returning the old value
func (*Tx) HDel ¶
func (b *Tx) HDel(key, field string, fields ...string) *ReplyInteger
HDel deletes fields from a map
func (*Tx) HGetAll ¶
func (b *Tx) HGetAll(key string) *ReplyBulkStringArray
HGetAll gets all field/value pairs in a map
func (*Tx) HIncrBy ¶
func (b *Tx) HIncrBy(key, field string, incr int64) *ReplyInteger
HIncrBy increments a field in a map
func (*Tx) HIncrByFloat ¶
func (b *Tx) HIncrByFloat(key, field string, incr float64) *ReplyFloat
HIncrByFloat increments a field in a map by a float value
func (*Tx) HKeys ¶
func (b *Tx) HKeys(key string) *ReplyBulkStringArray
HKeys gets all field keys in a map
func (*Tx) HLen ¶
func (b *Tx) HLen(key string) *ReplyInteger
HLen returns the number of fields in a map
func (*Tx) HMGet ¶
func (b *Tx) HMGet(key, field string, fields ...string) *ReplyBulkStringArray
HMGet returns the values associated with the specified fields in the hash stored at key. For convenience in cases where the fields are already an array the first field is compared to `field`
func (*Tx) HSet ¶
func (b *Tx) HSet(key, field, value string, entries ...string) *ReplyInteger
HSet adds an HSet command to the pipeline
func (*Tx) HSetArg ¶
func (b *Tx) HSetArg(key string, field string, value Arg, entries ...HArg) *ReplyInteger
HSetArg adds an HSet command to the pipeline using Arg
func (*Tx) HStrLen ¶
func (b *Tx) HStrLen(key, field string) *ReplyInteger
HStrLen returns the string length of the value of a field in a map
func (*Tx) HVals ¶
func (b *Tx) HVals(key string) *ReplyBulkStringArray
HVals returns the values of all fields in a map
func (*Tx) IncrBy ¶
func (b *Tx) IncrBy(key string, n int64) *ReplyInteger
IncrBy incremments the value at a key by an integer amount
func (*Tx) IncrByFloat ¶
func (b *Tx) IncrByFloat(key string, incr float64) *ReplyFloat
IncrByFloat incremments the value at a key by a float amount
func (*Tx) Keys ¶
func (b *Tx) Keys(pattern string) *ReplyBulkStringArray
Keys returns all keys matching a pattern
func (*Tx) LIndex ¶
func (c *Tx) LIndex(key string, index int64) *ReplyInteger
LIndex returns the element at index index in the list stored at key.
func (*Tx) LInsertAfter ¶
func (c *Tx) LInsertAfter(key string, pivot int64, value Arg) *ReplyInteger
LInsertAfter inserts element in the list stored at key after the reference value pivot. LINSERT key AFTER pivot element
func (*Tx) LInsertBefore ¶
func (c *Tx) LInsertBefore(key string, pivot int64, value Arg) *ReplyInteger
LInsertBefore inserts element in the list stored at key before the reference value pivot. LINSERT key BEFORE pivot element
func (*Tx) LLen ¶
func (c *Tx) LLen(key string) *ReplyInteger
LLen returns the length of the list stored at key.
func (*Tx) LPop ¶
func (c *Tx) LPop(key string) *ReplyBulkString
LPop removes and returns the first element of the list stored at key.
func (*Tx) LPush ¶
func (c *Tx) LPush(key string, values ...Arg) *ReplyInteger
LPush inserts specified values at the head of the list stored at key.
func (*Tx) LPushX ¶
func (c *Tx) LPushX(key string, values ...Arg) *ReplyInteger
LPushX inserts specified values at the head of the list stored at key, only if key already exists and holds a list.
func (*Tx) LRange ¶
func (c *Tx) LRange(key string, start, stop int64) *ReplyBulkStringArray
LRange returns the specified elements of the list stored at key. LRANGE key start stop
func (*Tx) LRem ¶
func (c *Tx) LRem(key string, count int64, element Arg) *ReplyInteger
LRem removes the first count occurrences of elements equal to element from the list stored at key.
func (*Tx) LTrim ¶
func (c *Tx) LTrim(key string, start, stop int64) *ReplyInteger
LTrim trims an existing list so that it will contain only the specified range of elements specified.
func (*Tx) MGet ¶
func (b *Tx) MGet(key string, keys ...string) *ReplyBulkStringArray
MGet gets multiple key values
func (*Tx) Move ¶
func (b *Tx) Move(key string, db int) *ReplyInteger
Move moves a key to a different DB index
func (*Tx) ObjectEncoding ¶
func (b *Tx) ObjectEncoding(key string) *ReplyBulkString
ObjectEncoding is the redis' OBJECT ENCODING command
func (*Tx) ObjectFreq ¶
func (b *Tx) ObjectFreq(key string) *ReplyInteger
ObjectFreq is the redis' OBJECT FREQ command
func (*Tx) ObjectHelp ¶
func (b *Tx) ObjectHelp(key string) *ReplyBulkString
ObjectHelp is the redis' OBJECT HELP command
func (*Tx) ObjectIdleTime ¶
func (b *Tx) ObjectIdleTime(key string) *ReplyInteger
ObjectIdleTime is the redis' OBJECT IDLETIME command
func (*Tx) ObjectRefCount ¶
func (b *Tx) ObjectRefCount(key string) *ReplyInteger
ObjectRefCount is the redis' OBJECT REFCOUNT command
func (*Tx) PExpire ¶
func (b *Tx) PExpire(key string, ttl time.Duration) *ReplyInteger
PExpire adds a TTL to a key in milliseconds
func (*Tx) PExpireAt ¶
func (b *Tx) PExpireAt(key string, tm time.Time) *ReplyInteger
PExpireAt is redis PEXPIREAT command
func (*Tx) PTTL ¶
func (b *Tx) PTTL(key string) *ReplyInteger
PTTL gets the TTL of a key in milliseconds
func (*Tx) Persist ¶
func (b *Tx) Persist(key string) *ReplyInteger
Persist removes any TTL from a key
func (Tx) PubSubChannels ¶
func (b Tx) PubSubChannels(pattern string) *ReplyBulkStringArray
PubSubChannels lists all active channels. PUBSUB CHANNELS [pattern] If no pattern is specified all channels are listed, otherwise if pattern is specified only channels matching the specified glob-style pattern are listed.
func (*Tx) PubSubNumPat ¶
func (b *Tx) PubSubNumPat() *ReplyInteger
PubSubNumPat returns the number of subscriptions to patterns (that are performed using the PSUBSCRIBE command). Note that this is not just the count of clients subscribed to patterns but the total number of patterns all the clients are subscribed to. PUBSUB NUMPAT
func (*Tx) PubSubNumSub ¶
func (b *Tx) PubSubNumSub(channels ...string) *ReplyInteger
PubSubNumSub returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels. PUBSUB NUMSUB [channel-1 ... channel-N]
func (*Tx) Publish ¶
func (b *Tx) Publish(channel, msg string) *ReplyInteger
Publish publishes a message on a channel
func (*Tx) RPop ¶
func (c *Tx) RPop(key string) *ReplyBulkString
RPop removes and returns the last element of the list stored at key.
func (*Tx) RPopLPush ¶
func (c *Tx) RPopLPush(src, dest string, timeout time.Duration) *ReplyBulkString
RPopLPush atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.
func (*Tx) RPush ¶
func (c *Tx) RPush(key string, elements ...Arg) *ReplyInteger
RPush inserts specified values at the tail of the list stored at key.
func (*Tx) RPushX ¶
func (c *Tx) RPushX(key string, elements ...Arg) *ReplyInteger
RPushX Inserts specified values at the tail of the list stored at key, only if key already exists and holds a list.
func (*Tx) SetRange ¶
func (b *Tx) SetRange(key string, offset int64, value string) *ReplyBulkString
SetRange sets a part of a string
func (*Tx) Sort ¶
func (b *Tx) Sort(key string, sort Sort) *ReplyBulkStringArray
Sort sorts a key's values
func (*Tx) SortStore ¶
func (b *Tx) SortStore(dest, key string, sort Sort) *ReplyInteger
SortStore sorts a `key`'s value storing the result in `dest`
func (*Tx) StrLen ¶
func (b *Tx) StrLen(key string) *ReplyBulkString
StrLen return the length of a string value
func (*Tx) TTL ¶
func (b *Tx) TTL(key string) *ReplyInteger
TTL returns the remaining lifetime of a key in seconds
func (*Tx) Touch ¶
func (b *Tx) Touch(keys ...string) *ReplyInteger
Touch alters the last access time of a key(s).
func (*Tx) Type ¶
func (b *Tx) Type(key string) *ReplySimpleString
Type returns the type of the value of a key
func (*Tx) Wait ¶
func (b *Tx) Wait(numReplicas int, timeout time.Duration) *ReplyInteger
Wait blocks until a number of replicas have stored the data or timeout occured
func (*Tx) XAck ¶
func (b *Tx) XAck(key, group string, id string, ids ...string) *ReplyInteger
XAck removes one or multiple messages from the pending entries list (PEL) of a stream consumer group. XACK key group ID [ID ...]
func (*Tx) XAdd ¶
func (b *Tx) XAdd(key string, maxLen int64, id string, fields ...HArg) *ReplyBulkString
XAdd appends the specified stream entry to the stream at the specified key.
XADD key ID field value [field value ...]
If the key does not exist, as a side effect of running this command, the key is created with a stream value.
func (*Tx) XDel ¶
func (b *Tx) XDel(key string, ids ...string) *ReplyInteger
XDel deletes entries from a stream
func (*Tx) XGroupCreate ¶
XGroupCreate creates a new consumer group associated with a stream. XGROUP [CREATE key groupname id-or-$]
func (*Tx) XGroupDelConsumer ¶
func (b *Tx) XGroupDelConsumer(key, group, consumer string) *ReplyInteger
XGroupDelConsumer removes a specific consumer from a consumer group
func (*Tx) XGroupDestroy ¶
func (b *Tx) XGroupDestroy(key, group string) *ReplyInteger
XGroupDestroy destroys a consumer group
func (*Tx) XGroupSetID ¶
XGroupSetID sets the consumer group last delivered ID to something else. XGROUP [SETID key groupname id-or-$]
func (*Tx) XInfoConsumers ¶
func (b *Tx) XInfoConsumers(key, group string) *ReplyXInfoConsumers
XInfoConsumers returns the list of every consumer in a specific consumer group
func (*Tx) XInfoGroups ¶
func (b *Tx) XInfoGroups(key string) *ReplyXInfoGroups
XInfoGroups returns all the consumer groups associated with the stream.
func (*Tx) XInfoHelp ¶
func (b *Tx) XInfoHelp() *ReplyBulkStringArray
XInfoHelp gets help for XINFO command
func (*Tx) XInfoStream ¶
func (b *Tx) XInfoStream(key string) *ReplyXInfoStream
XInfoStream returns general information about the stream stored at the specified key.
func (*Tx) XLen ¶
func (b *Tx) XLen(key string) *ReplyInteger
XLen returns the number of entries inside a stream.
func (*Tx) XPending ¶
func (b *Tx) XPending(key, group string) *ReplyXPendingSummary
func (*Tx) XPendingConsumer ¶
func (b *Tx) XPendingConsumer(args XPending) *ReplyXPending
func (*Tx) XPendingGroup ¶
func (b *Tx) XPendingGroup(args XPending) *ReplyXPending
func (*Tx) XRange ¶
func (b *Tx) XRange(key, group, start, end string, count int64) *ReplyXRange
Command implements Commander interface
func (*Tx) XRevRange ¶
func (b *Tx) XRevRange(key, group, end, start string, count int64) *ReplyXRange
func (*Tx) ZAdd ¶
func (b *Tx) ZAdd(key string, mode Mode, members ...ZEntry) *ReplyInteger
ZAdd adds or modifies the a member of a sorted set
func (*Tx) ZAddIncr ¶
func (b *Tx) ZAddIncr(key string, mode Mode, member string, d float64) *ReplyFloat
ZAddIncr increments the score of a sorted set member by d
func (*Tx) ZCard ¶
func (b *Tx) ZCard(key string) *ReplyInteger
ZCard returns the cardinality of a sorted set
func (*Tx) ZCount ¶
func (b *Tx) ZCount(key string, min, max Arg) *ReplyInteger
ZCount returns the number of elements in the sorted set at key with a score between min and max.
func (*Tx) ZIncrBy ¶
func (b *Tx) ZIncrBy(key string, incr float64, member string) *ReplyFloat
ZIncrBy increments the score of member in the sorted set stored at key by increment.
func (*Tx) ZInterStore ¶
func (b *Tx) ZInterStore(args ZStore) *ReplyInteger
ZInterStore computes the intersection of numkeys sorted sets given by the specified keys, and stores the result in destination.
func (*Tx) ZLexCount ¶
func (b *Tx) ZLexCount(key string, min, max Arg) *ReplyInteger
ZLexCount returns the number of elements in the sorted set at key with a value between min and max.
func (*Tx) ZPopMax ¶
func (b *Tx) ZPopMax(key string, count int64) *ReplyZRange
ZPopMax removes and returns up to count members with the highest scores in the sorted set stored at key.
func (*Tx) ZPopMin ¶
func (b *Tx) ZPopMin(key string, count int64) *ReplyZRange
ZPopMin removes and returns up to count members with the lowest scores in the sorted set stored at key.
func (*Tx) ZRange ¶
func (b *Tx) ZRange(key string, start, stop int64) *ReplyBulkStringArray
ZRange returns the specified range of elements in the sorted set stored at key.
func (*Tx) ZRangeByLex ¶
func (b *Tx) ZRangeByLex(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
ZRangeByLex when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returnWhen 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.s all the elements in the sorted set at key with a value between min and max.
func (*Tx) ZRangeByScore ¶
func (b *Tx) ZRangeByScore(key string, min, max Arg, offset, count int64) *ReplyBulkStringArray
ZRangeByScore returns all the elements in the sorted set at key with a score between min and max
func (*Tx) ZRangeByScoreWithScores ¶
func (b *Tx) ZRangeByScoreWithScores(key string, min, max Arg, offset, count int64) *ReplyZRange
ZRangeByScoreWithScores returns all the elements in the sorted set at key with a score between min and max
func (*Tx) ZRangeWithScores ¶
func (b *Tx) ZRangeWithScores(key string, start, stop int64) *ReplyZRange
ZRangeWithScores returns the specified range of elements in the sorted set stored at key.
func (*Tx) ZRank ¶
func (b *Tx) ZRank(key, member string) *ReplyInteger
ZRank gets the rank of a member of a sorted set ordered from low to high
func (*Tx) ZRem ¶
func (b *Tx) ZRem(key string, members ...string) *ReplyInteger
ZRem removes member(s) from a sorted set
func (*Tx) ZRemRangeByLex ¶
func (b *Tx) ZRemRangeByLex(key string, min, max Arg) *ReplyInteger
ZRemRangeByLex removes all elements in the sorted set stored at key between the lexicographical range specified by min and max.
func (*Tx) ZRemRangeByRank ¶
func (b *Tx) ZRemRangeByRank(key string, start, stop int64) *ReplyInteger
ZRemRangeByRank removes all elements in the sorted set stored at key with rank between start and stop.
func (*Tx) ZRemRangeByScore ¶
func (b *Tx) ZRemRangeByScore(key string, min, max Arg) *ReplyInteger
ZRemRangeByScore removes all elements in the sorted set stored at key with a score between min and max (inclusive).
func (*Tx) ZRevRange ¶
func (b *Tx) ZRevRange(key string, start, stop int64) *ReplyBulkStringArray
ZRevRange returns the specified range of elements in the sorted set stored at key.
func (*Tx) ZRevRangeByLex ¶
func (b *Tx) ZRevRangeByLex(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
ZRevRangeByLex when all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returnWhen 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.s all the elements in the sorted set at key with a value between min and max.
func (*Tx) ZRevRangeByScore ¶
func (b *Tx) ZRevRangeByScore(key string, max, min Arg, offset, count int64) *ReplyBulkStringArray
ZRevRangeByScore returns all the elements in the sorted set at key with a score between min and max
func (*Tx) ZRevRangeByScoreWithScores ¶
func (b *Tx) ZRevRangeByScoreWithScores(key string, max, min Arg, offset, count int64) *ReplyZRange
ZRevRangeByScoreWithScores returns all the elements in the sorted set at key with a score between min and max
func (*Tx) ZRevRangeWithScores ¶
func (b *Tx) ZRevRangeWithScores(key string, start, stop int64) *ReplyZRange
ZRevRangeWithScores returns the specified range of elements in the sorted set stored at key.
func (*Tx) ZRevRank ¶
func (b *Tx) ZRevRank(key, member string) *ReplyInteger
ZRevRank gets the rank of a member of a sorted set ordered from high to low
func (*Tx) ZScore ¶
func (b *Tx) ZScore(key, member string) *ReplyFloat
ZScore returns the score of a member
func (*Tx) ZUnionStore ¶
func (b *Tx) ZUnionStore(args ZStore) *ReplyInteger
ZUnionStore computes the union of numkeys sorted sets given by the specified keys, and stores the result in destination.
type XClaim ¶
type XClaim struct { Key string Group string Consumer string MinIdleTime time.Duration IDs []string Idle time.Duration RetryCount int Force bool Time time.Time JustID bool }
XClaim claims a pending message in a consumer group.
XCLAIM key group consumer min-idle-time ID [ID ...] [IDLE ms] [TIME ms-unix-time] [RETRYCOUNT count] [FORCE] [JUSTID] Available since 5.0.0. Time complexity: O(log N) with N being the number of messages in the PEL of the consumer group.
In the context of a stream consumer group, this command changes the ownership of a pending message, so that the new owner is the consumer specified as the command argument. Normally this is what happens:
- There is a stream with an associated consumer group.
- Some consumer A reads a message via XREADGROUP from a stream, in the context of that consumer group.
- As a side effect a pending message entry is created in the pending entries list (PEL) of the consumer group: it means the message was delivered to a given consumer, but it was not yet acknowledged via XACK.
- Then suddenly that consumer fails forever.
- Other consumers may inspect the list of pending messages, that are stale for quite some time, using the XPENDING command. In order to continue processing such messages, they use XCLAIM to acquire the ownership of the message and continue.
This dynamic is clearly explained in the [Stream intro documentation](https://redis.io/topics/streams-intro).
func (*XClaim) BuildCommand ¶
func (cmd *XClaim) BuildCommand(args *ArgBuilder) string
BuildCommand implements CommandBuilder interface
type XInfoConsumer ¶
func (*XInfoConsumer) UnmarshalRESP ¶
func (info *XInfoConsumer) UnmarshalRESP(v resp.Value) error
type XInfoEntry ¶
func (*XInfoEntry) UnmarshalRESP ¶
func (info *XInfoEntry) UnmarshalRESP(v resp.Value) error
type XInfoGroup ¶
func (*XInfoGroup) UnmarshalRESP ¶
func (info *XInfoGroup) UnmarshalRESP(v resp.Value) error
type XInfoStream ¶
type XInfoStream struct { Length int64 RadixTreeKeys int64 RadixTreeNodes int64 Groups int64 LastGeneratedID resp.BulkString FirstEntry XInfoEntry LastEntry XInfoEntry }
func (*XInfoStream) UnmarshalRESP ¶
func (info *XInfoStream) UnmarshalRESP(v resp.Value) error
type XPending ¶
func (*XPending) BuildCommand ¶
func (cmd *XPending) BuildCommand(args *ArgBuilder) string
BuildCommand implements CommandBuilder interface
type XPendingConsumer ¶
func (*XPendingConsumer) UnmarshalRESP ¶
func (x *XPendingConsumer) UnmarshalRESP(v resp.Value) error
type XPendingEntry ¶
type XPendingEntry struct { ID string Consumer string Retries int64 // contains filtered or unexported fields }
func (*XPendingEntry) Age ¶
func (x *XPendingEntry) Age() time.Duration
func (*XPendingEntry) UnmarshalRESP ¶
func (x *XPendingEntry) UnmarshalRESP(v resp.Value) error
type XPendingSummary ¶
type XPendingSummary struct { Pending int64 MinID string MaxID string Consumers []XPendingConsumer }
func (*XPendingSummary) UnmarshalRESP ¶
func (x *XPendingSummary) UnmarshalRESP(v resp.Value) error
type XRead ¶
type XRead struct { Count int64 Group string Consumer string NoACK bool Block time.Duration Streams []XReadStream }
func (*XRead) BuildCommand ¶
func (cmd *XRead) BuildCommand(args *ArgBuilder) string
BuildCommand implements CommandBuilder interface
type XReadStream ¶
func Stream ¶
func Stream(key, id string) XReadStream