Documentation
¶
Index ¶
- Constants
- func BlankReply() *resp.Reply
- func ReleasePipeline(p *Pipeline)
- func ReleaseReply(r *resp.Reply)
- type Conn
- func (c *Conn) Auth(password string) error
- func (c *Conn) Close() error
- func (c *Conn) Do(pipeline *Pipeline, reply *resp.Reply) (err error)
- func (c *Conn) LoadScript(src string) (sha1 string, err error)
- func (c *Conn) Ping() error
- func (c *Conn) PopLeft(timeout time.Duration, key string, keys ...string) (k, v string, err error)
- func (c *Conn) PopMax(timeout time.Duration, key string, keys ...string) (k, v string, score float64, err error)
- func (c *Conn) PopMin(timeout time.Duration, key string, keys ...string) (k, v string, score float64, err error)
- func (c *Conn) PopPush(src, dst string, timeout time.Duration) (string, error)
- func (c *Conn) PopRight(timeout time.Duration, key string, keys ...string) (k, v string, err error)
- func (c *Conn) Quit() error
- func (c *Conn) Read(p []byte) (n int, err error)
- func (c *Conn) Select(db int64)
- func (c *Conn) Write(p []byte) (n int, err error)
- type ConnOptions
- type Err
- type Migrate
- type Pipeline
- func (p *Pipeline) Append(key string, value resp.Arg)
- func (p *Pipeline) Auth(password string)
- func (p *Pipeline) BGRewriteAOF()
- func (p *Pipeline) BGSave()
- func (p *Pipeline) BLPop(timeout time.Duration, keys ...string)
- func (p *Pipeline) BRPop(timeout time.Duration, keys ...string)
- func (p *Pipeline) BRPopLPush(src, dest string, timeout time.Duration)
- func (p *Pipeline) BitAND(dest string, src ...string)
- func (p *Pipeline) BitCount(key string, start, end int64)
- func (p *Pipeline) BitNOT(dest, src string)
- func (p *Pipeline) BitOR(dest string, src ...string)
- func (p *Pipeline) BitPos(key string, bit uint, startEnd ...int64)
- func (p *Pipeline) BitXOR(dest string, src ...string)
- func (p *Pipeline) Command(cmd string, numArgs int)
- func (p *Pipeline) Decr(key string)
- func (p *Pipeline) DecrBy(key string, d int64)
- func (p *Pipeline) Del(keys ...string)
- func (p *Pipeline) Discard()
- func (p *Pipeline) Dump(key string)
- func (p *Pipeline) Echo(message string)
- func (p *Pipeline) Eval(script string, keysAndArgs ...resp.Arg)
- func (p *Pipeline) EvalSHA(sha1 string, keysAndArgs ...resp.Arg)
- func (p *Pipeline) Exec()
- func (p *Pipeline) Exists(keys ...string)
- func (p *Pipeline) Expire(key string, ttl time.Duration)
- func (p *Pipeline) ExpireAt(key string, tm time.Time)
- func (p *Pipeline) FlushDB()
- func (p *Pipeline) Get(key string)
- func (p *Pipeline) GetBit(key string, offset int64)
- func (p *Pipeline) GetRange(key string, start, end int64)
- func (p *Pipeline) GetSet(key string, value resp.Arg)
- func (p *Pipeline) HDel(key string, fields ...string)
- func (p *Pipeline) HExists(key string, field string)
- func (p *Pipeline) HGet(key, field string)
- func (p *Pipeline) HGetAll(key string)
- func (p *Pipeline) HIncrBy(key, field string, n int64)
- func (p *Pipeline) HIncrByFloat(key, field string, f float64)
- func (p *Pipeline) HKeys(key string)
- func (p *Pipeline) HLen(key string)
- func (p *Pipeline) HMGet(key string, fields ...string)
- func (p *Pipeline) HMSet(key string, values ...resp.KV)
- func (p *Pipeline) HScan(key string, cur int64, match string, count int64)
- func (p *Pipeline) HSet(key, field string, value resp.Arg)
- func (p *Pipeline) HSetNX(key, field string, value resp.Arg)
- func (p *Pipeline) HStrLen(key, field string)
- func (p *Pipeline) HVals(key string)
- func (p *Pipeline) Incr(key string)
- func (p *Pipeline) IncrBy(key string, d int64)
- func (p *Pipeline) IncrByFloat(key string, f float64)
- func (p *Pipeline) Keys(pattern string)
- func (p *Pipeline) LIndex(key string, index int64)
- func (p *Pipeline) LInsertAfter(key string, pivot int64, value resp.Arg)
- func (p *Pipeline) LInsertBefore(key string, pivot int64, value resp.Arg)
- func (p *Pipeline) LLen(key string)
- func (p *Pipeline) LPop(key string)
- func (p *Pipeline) LPush(key string)
- func (p *Pipeline) LPushX(key string)
- func (p *Pipeline) LRange(key string, start, stop int64)
- func (p *Pipeline) LRem(key string, count int64, value resp.Arg)
- func (p *Pipeline) LSet(key string, index int64, value resp.Arg)
- func (p *Pipeline) LTrim(key string, start, stop int64)
- func (p *Pipeline) Len() int
- func (p *Pipeline) MGet(keys ...string)
- func (p *Pipeline) MSet(pairs ...resp.KV)
- func (p *Pipeline) MSetNX(pairs ...resp.KV)
- func (p *Pipeline) Migrate(m Migrate, keys ...string)
- func (p *Pipeline) Move(key string, db int64)
- func (p *Pipeline) Multi()
- func (p *Pipeline) PFAdd(key string, elements ...string)
- func (p *Pipeline) PFCount(keys ...string)
- func (p *Pipeline) PFMerge(dest string, src ...string)
- func (p *Pipeline) PTTL(key string)
- func (p *Pipeline) Persist(key string)
- func (p *Pipeline) Ping(message string)
- func (p *Pipeline) Quit()
- func (p *Pipeline) RPop(key string)
- func (p *Pipeline) RPopLPush(src, dest string)
- func (p *Pipeline) RPush(key string, values ...resp.Arg)
- func (p *Pipeline) RPushX(key string, value resp.Arg)
- func (p *Pipeline) RandomKey()
- func (p *Pipeline) Rename(key, newkey string)
- func (p *Pipeline) RenameNX(key, newkey string)
- func (p *Pipeline) Reset()
- func (p *Pipeline) Restore(key string, ttl time.Duration, data []byte, replace bool, idletime int64, ...)
- func (p *Pipeline) SAdd(key string, members ...resp.Arg)
- func (p *Pipeline) SCard(key string)
- func (p *Pipeline) SDiff(keys ...string)
- func (p *Pipeline) SDiffStore(dest string, keys ...string)
- func (p *Pipeline) SInter(keys ...string)
- func (p *Pipeline) SInterStore(dest string, keys ...string)
- func (p *Pipeline) SIsMember(key, member string)
- func (p *Pipeline) SMembers(key string)
- func (p *Pipeline) SMove(src, dest, member string)
- func (p *Pipeline) SPop(key string, count int64)
- func (p *Pipeline) SRandMember(key string, count int64)
- func (p *Pipeline) SRem(key string, members ...resp.Arg)
- func (p *Pipeline) SScan(key string, cur int64, match string, count int64)
- func (p *Pipeline) SUnion(keys ...string)
- func (p *Pipeline) SUnionStore(dest string, keys ...string)
- func (p *Pipeline) Scan(cur int64, match string, count int64)
- func (p *Pipeline) ScriptDebug(debug bool)
- func (p *Pipeline) ScriptDebugSync()
- func (p *Pipeline) ScriptExists(sha1 ...string)
- func (p *Pipeline) ScriptFlush()
- func (p *Pipeline) ScriptKill()
- func (p *Pipeline) ScriptLoad(script string)
- func (p *Pipeline) Select(db int64)
- func (p *Pipeline) Set(key string, value resp.Arg, ttl time.Duration)
- func (p *Pipeline) SetNX(key string, value resp.Arg, ttl time.Duration)
- func (p *Pipeline) SetRange(key string, offset int64, value resp.Arg)
- func (p *Pipeline) SetXX(key string, value resp.Arg, ttl time.Duration)
- func (p *Pipeline) Size() int
- func (p *Pipeline) Sort(key string, options Sort)
- func (p *Pipeline) StrLen(key string)
- func (p *Pipeline) SwapDB(i, j int64)
- func (p *Pipeline) TTL(key string)
- func (p *Pipeline) Touch(keys ...string)
- func (p *Pipeline) Type(key string)
- func (p *Pipeline) Unlink(keys ...string)
- func (p *Pipeline) Unwatch()
- func (p *Pipeline) Wait(replicas int64, timeout time.Duration)
- func (p *Pipeline) Watch(keys ...string)
- func (p *Pipeline) ZAdd(key string, add SetMode, changed bool, members ...ZMember)
- func (p *Pipeline) ZCard(key string)
- func (p *Pipeline) ZCount(key string, min, max float64)
- func (p *Pipeline) ZIncrBy(key string, inc float64, member string)
- func (p *Pipeline) ZIncrByNX(key string, inc float64, member string)
- func (p *Pipeline) ZIncrByXX(key string, inc float64, member string)
- func (p *Pipeline) ZInterStore(dest string, keysAndWeights ...resp.Arg)
- func (p *Pipeline) ZLexCount(key, min, max string)
- func (p *Pipeline) ZPopMax(key string, count int64)
- func (p *Pipeline) ZPopMin(key string, count int64)
- func (p *Pipeline) ZRange(key string, start, stop int64, scores bool)
- func (p *Pipeline) ZRangeByLex(key, min, max string, offset, count int64)
- func (p *Pipeline) ZRangeByScore(key string, min, max float64, scores bool, offset, count int64)
- func (p *Pipeline) ZRank(key, member string)
- func (p *Pipeline) ZRem(key string, members ...resp.Arg)
- func (p *Pipeline) ZRemRangeByLex(key, min, max string)
- func (p *Pipeline) ZRemRangeByRank(key string, start, stop int64)
- func (p *Pipeline) ZRemRangeByScore(key string, min, max float64)
- func (p *Pipeline) ZRevRank(key, member string)
- func (p *Pipeline) ZScan(key string, cur int64, match string, count int64)
- func (p *Pipeline) ZScore(key, member string)
- func (p *Pipeline) ZUnionStore(dest string, keysAndWeights ...resp.Arg)
- type Pool
- func (pool *Pool) Close() error
- func (pool *Pool) Deadline() time.Time
- func (pool *Pool) Do(p *Pipeline, r *resp.Reply) error
- func (pool *Pool) Get() (*Conn, error)
- func (pool *Pool) Idle() int
- func (Pool) Lock()
- func (pool *Pool) Open() int
- func (pool *Pool) ParseURL(rawurl string) (err error)
- func (pool *Pool) Pipeline() *Pipeline
- func (pool *Pool) Put(c *Conn)
- func (pool *Pool) Stats() PoolStats
- func (Pool) Unlock()
- type PoolStats
- type ScanIterator
- type SetMode
- type Sort
- type TimeoutError
- type ZMember
Constants ¶
const ErrIteratorClosed = Err("Iterator closed")
ErrIteratorClosed occurs when an iterator is used after Close()
Variables ¶
This section is empty.
Functions ¶
func ReleasePipeline ¶
func ReleasePipeline(p *Pipeline)
ReleasePipeline resets and returns the pipeline to the pool
func ReleaseReply ¶
ReleaseReply resets and returns a Reply to the pool.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a connectio to a Redis server
func Dial ¶
func Dial(addr string, options ConnOptions) (*Conn, error)
Dial opens a connection to a redis server
func (*Conn) LoadScript ¶
LoadScript loads a Lua script
func (*Conn) PopMax ¶
func (c *Conn) PopMax(timeout time.Duration, key string, keys ...string) (k, v string, score float64, err error)
PopMax executes the blocking BZPOPMAX command
func (*Conn) PopMin ¶
func (c *Conn) PopMin(timeout time.Duration, key string, keys ...string) (k, v string, score float64, err error)
PopMin executes the blocking BZPOPMIN command
type ConnOptions ¶
type ConnOptions struct { ReadBufferSize int ReadTimeout time.Duration WriteTimeout time.Duration WriteOnly bool }
ConnOptions holds connection options
type Migrate ¶
type Migrate struct { Host string Port string DB int64 Timeout time.Duration Copy bool Replace bool }
Migrate options
type Pipeline ¶
Pipeline is a command buffer
func BlankPipeline ¶
BlankPipeline gets a blank pipeline from the pool
func (*Pipeline) BGRewriteAOF ¶
func (p *Pipeline) BGRewriteAOF()
func (*Pipeline) BRPopLPush ¶
func (*Pipeline) Discard ¶
func (p *Pipeline) Discard()
Discard discards all commands issued after MULTI
func (*Pipeline) HIncrByFloat ¶
HIncrByFloat increments the float value of a hash field by the given amount
func (*Pipeline) IncrByFloat ¶
func (*Pipeline) LInsertAfter ¶
func (*Pipeline) LInsertBefore ¶
func (*Pipeline) RandomKey ¶
func (p *Pipeline) RandomKey()
RandomKey returns a random key from the keyspace
func (*Pipeline) Restore ¶
func (p *Pipeline) Restore(key string, ttl time.Duration, data []byte, replace bool, idletime int64, frequency int64)
Restore creates a key using the provided serialized value, previously obtained using DUMP
func (*Pipeline) SDiffStore ¶
func (*Pipeline) SInterStore ¶
func (*Pipeline) SRandMember ¶
func (*Pipeline) SUnionStore ¶
func (*Pipeline) ScriptDebug ¶
ScriptDebug sets the debug mode for executed scripts to YES/NO
func (*Pipeline) ScriptDebugSync ¶
func (p *Pipeline) ScriptDebugSync()
ScriptDebugSync sets the debug mode for executed scripts to SYNC
func (*Pipeline) ScriptExists ¶
ScriptExists checks existence of scripts in the script cache
func (*Pipeline) ScriptFlush ¶
func (p *Pipeline) ScriptFlush()
ScriptFlush removes all the scripts from the script cache
func (*Pipeline) ScriptKill ¶
func (p *Pipeline) ScriptKill()
ScriptKill kills the script currently in execution
func (*Pipeline) ScriptLoad ¶
ScriptLoad loads the specified Lua script into the script cache
func (*Pipeline) Wait ¶
Wait waits for the synchronous replication of all the write commands sent in the context of the current connection
func (*Pipeline) Watch ¶
Watch watches the given keys to determine execution of the MULTI/EXEC block
func (*Pipeline) ZCount ¶
ZCount counts the number of members in a sorted set with scores within the given values
func (*Pipeline) ZIncrByNX ¶
ZIncrByNX increments the score of a member in a sorted set, only if the member does not exist in the set
func (*Pipeline) ZIncrByXX ¶
ZIncrByXX increments the score of a member in a sorted set, only if the member already exists in the set
func (*Pipeline) ZInterStore ¶
ZInterStore intersects multiple sorted sets and stores the resulting sorted set in a new key
func (*Pipeline) ZLexCount ¶
ZLexCount counts the number of members in a sorted set between a given lexicographical range
func (*Pipeline) ZPopMax ¶
ZPopMax removes and returns members with the highest scores in a sorted set
func (*Pipeline) ZPopMin ¶
ZPopMin removes and returns members with the lowest scores in a sorted set
func (*Pipeline) ZRangeByLex ¶
ZRangeByLex returns a range of members in a sorted set, by lexicographical range
func (*Pipeline) ZRangeByScore ¶
ZRangeByScore returns a range of members in a sorted set, by score
func (*Pipeline) ZRemRangeByLex ¶
ZRemRangeByLex removes a range of members in a sorted set, between the given lexicographical range
func (*Pipeline) ZRemRangeByRank ¶
ZRemRangeByRank removes a range of members in a sorted set, within the given indexes
func (*Pipeline) ZRemRangeByScore ¶
ZRemRangeByScore removes a range of members in a sorted set, within the given scores
func (*Pipeline) ZRevRank ¶
ZRevRank determines the index of a member in a sorted set, with scores ordered from high to low
type Pool ¶
type Pool struct { ReadBufferSize int ReadTimeout time.Duration WriteTimeout time.Duration WaitTimeout time.Duration Address string MaxConnections int MaxIdleTime time.Duration MaxConnectionAge time.Duration CheckIdleInterval time.Duration DB int Dial func(address string, timeout time.Duration) (net.Conn, error) // contains filtered or unexported fields }
Pool is a pool of redis connections
type PoolStats ¶
type PoolStats struct {
Hits, Misses, Timeouts int64
}
PoolStats counts pool statistics
type ScanIterator ¶
type ScanIterator struct {
// contains filtered or unexported fields
}
ScanIterator is an iterator for Redis scan commands
func HScan ¶
func HScan(key, match string, count int64) *ScanIterator
HScan starts a hash object scan iterator
func SScan ¶
func SScan(key, match string, count int64) *ScanIterator
SScan starts a set scan iterator
func ZScan ¶
func ZScan(key, match string, count int64) *ScanIterator
ZScan starts a sorted set scan iterator
type SetMode ¶
type SetMode uint
SetMode determines the update mode for SET command
const ( NX SetMode XX )
SetMode enum
type TimeoutError ¶
type TimeoutError struct{}
TimeoutError is an error indicating blocking command timeout
func (*TimeoutError) Error ¶
func (*TimeoutError) Error() string
func (*TimeoutError) IsTimeout ¶
func (*TimeoutError) IsTimeout() bool
IsTimeout implements IsTimeouter interface