Documentation ¶
Index ¶
- Constants
- type ConnFactory
- type HAConfig
- type HAConnFactory
- type Pool
- func (p *Pool) Append(key, value string) *redis.IntCmd
- func (p *Pool) BLPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (p *Pool) BRPop(timeout time.Duration, keys ...string) *redis.StringSliceCmd
- func (p *Pool) BRPopLPush(source, destination string, timeout time.Duration) *redis.StringCmd
- func (p *Pool) BitCount(key string, bitCount *redis.BitCount) *redis.IntCmd
- func (p *Pool) BitField(key string, args ...interface{}) *redis.IntSliceCmd
- func (p *Pool) BitOp(op int, destKey string, keys ...string) *redis.IntCmd
- func (p *Pool) BitOpAnd(destKey string, keys ...string) *redis.IntCmd
- func (p *Pool) BitOpNot(destKey string, key string) *redis.IntCmd
- func (p *Pool) BitOpOr(destKey string, keys ...string) *redis.IntCmd
- func (p *Pool) BitOpXor(destKey string, keys ...string) *redis.IntCmd
- func (p *Pool) BitPos(key string, bit int64, pos ...int64) *redis.IntCmd
- func (p *Pool) Close()
- func (p *Pool) DebugObject(key string) *redis.StringCmd
- func (p *Pool) Decr(key string) *redis.IntCmd
- func (p *Pool) DecrBy(key string, decrement int64) *redis.IntCmd
- func (p *Pool) Del(keys ...string) (int64, error)
- func (p *Pool) Dump(key string) *redis.StringCmd
- func (p *Pool) Echo(message interface{}) *redis.StringCmd
- func (p *Pool) Eval(script string, keys []string, args ...interface{}) *redis.Cmd
- func (p *Pool) EvalSha(sha1 string, keys []string, args ...interface{}) *redis.Cmd
- func (p *Pool) Exists(keys ...string) (int64, error)
- func (p *Pool) Expire(key string, expiration time.Duration) *redis.BoolCmd
- func (p *Pool) ExpireAt(key string, tm time.Time) *redis.BoolCmd
- func (p *Pool) GeoAdd(key string, geoLocation ...*redis.GeoLocation) *redis.IntCmd
- func (p *Pool) GeoDist(key string, member1, member2, unit string) *redis.FloatCmd
- func (p *Pool) GeoHash(key string, members ...string) *redis.StringSliceCmd
- func (p *Pool) GeoPos(key string, members ...string) *redis.GeoPosCmd
- func (p *Pool) GeoRadius(key string, longitude, latitude float64, query *redis.GeoRadiusQuery) *redis.GeoLocationCmd
- func (p *Pool) GeoRadiusByMember(key, member string, query *redis.GeoRadiusQuery) *redis.GeoLocationCmd
- func (p *Pool) GeoRadiusByMemberStore(key, member string, query *redis.GeoRadiusQuery) *redis.IntCmd
- func (p *Pool) GeoRadiusStore(key string, longitude, latitude float64, query *redis.GeoRadiusQuery) *redis.IntCmd
- func (p *Pool) Get(key string) *redis.StringCmd
- func (p *Pool) GetBit(key string, offset int64) *redis.IntCmd
- func (p *Pool) GetRange(key string, start, end int64) *redis.StringCmd
- func (p *Pool) GetSet(key string, value interface{}) *redis.StringCmd
- func (p *Pool) HDel(key string, fields ...string) *redis.IntCmd
- func (p *Pool) HExists(key, field string) *redis.BoolCmd
- func (p *Pool) HGet(key, field string) *redis.StringCmd
- func (p *Pool) HGetAll(key string) *redis.StringStringMapCmd
- func (p *Pool) HIncrBy(key, field string, incr int64) *redis.IntCmd
- func (p *Pool) HIncrByFloat(key, field string, incr float64) *redis.FloatCmd
- func (p *Pool) HKeys(key string) *redis.StringSliceCmd
- func (p *Pool) HLen(key string) *redis.IntCmd
- func (p *Pool) HMGet(key string, fields ...string) *redis.SliceCmd
- func (p *Pool) HMSet(key string, values ...interface{}) *redis.BoolCmd
- func (p *Pool) HScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (p *Pool) HSet(key, field string, value interface{}) *redis.IntCmd
- func (p *Pool) HSetNX(key, field string, value interface{}) *redis.BoolCmd
- func (p *Pool) HVals(key string) *redis.StringSliceCmd
- func (p *Pool) Incr(key string) *redis.IntCmd
- func (p *Pool) IncrBy(key string, increment int64) *redis.IntCmd
- func (p *Pool) IncrByFloat(key string, value float64) *redis.FloatCmd
- func (p *Pool) LIndex(key string, index int64) *redis.StringCmd
- func (p *Pool) LInsert(key, op string, pivot, value interface{}) *redis.IntCmd
- func (p *Pool) LInsertAfter(key string, pivot, value interface{}) *redis.IntCmd
- func (p *Pool) LInsertBefore(key string, pivot, value interface{}) *redis.IntCmd
- func (p *Pool) LLen(key string) *redis.IntCmd
- func (p *Pool) LPop(key string) *redis.StringCmd
- func (p *Pool) LPush(key string, values ...interface{}) *redis.IntCmd
- func (p *Pool) LPushX(key string, values ...interface{}) *redis.IntCmd
- func (p *Pool) LRange(key string, start, stop int64) *redis.StringSliceCmd
- func (p *Pool) LRem(key string, count int64, value interface{}) *redis.IntCmd
- func (p *Pool) LSet(key string, index int64, value interface{}) *redis.StatusCmd
- func (p *Pool) LTrim(key string, start, stop int64) *redis.StatusCmd
- func (p *Pool) MGet(keys ...string) ([]interface{}, error)
- func (p *Pool) MSet(values ...interface{}) *redis.StatusCmd
- func (p *Pool) MSetNX(values ...interface{}) *redis.BoolCmd
- func (p *Pool) MemoryUsage(key string, samples ...int) *redis.IntCmd
- func (p *Pool) ObjectEncoding(key string) *redis.StringCmd
- func (p *Pool) ObjectIdleTime(key string) *redis.DurationCmd
- func (p *Pool) ObjectRefCount(key string) *redis.IntCmd
- func (p *Pool) PFAdd(key string, els ...interface{}) *redis.IntCmd
- func (p *Pool) PFCount(keys ...string) *redis.IntCmd
- func (p *Pool) PFMerge(dest string, keys ...string) *redis.StatusCmd
- func (p *Pool) Ping() *redis.StatusCmd
- func (p *Pool) Pipeline() (redis.Pipeliner, error)
- func (p *Pool) Pipelined(fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
- func (p *Pool) PubSubChannels(pattern string) *redis.StringSliceCmd
- func (p *Pool) PubSubNumPat() *redis.IntCmd
- func (p *Pool) PubSubNumSub(channels ...string) *redis.StringIntMapCmd
- func (p *Pool) Publish(channel string, message interface{}) *(redis.IntCmd)
- func (p *Pool) RPop(key string) *redis.StringCmd
- func (p *Pool) RPopLPush(source, destination string) *redis.StringCmd
- func (p *Pool) RPush(key string, values ...interface{}) *redis.IntCmd
- func (p *Pool) RPushX(key string, values ...interface{}) *redis.IntCmd
- func (p *Pool) Rename(key, newkey string) *redis.StatusCmd
- func (p *Pool) RenameNX(key, newkey string) *redis.BoolCmd
- func (p *Pool) SAdd(key string, members ...interface{}) *redis.IntCmd
- func (p *Pool) SCard(key string) *redis.IntCmd
- func (p *Pool) SDiff(keys ...string) *redis.StringSliceCmd
- func (p *Pool) SDiffStore(destination string, keys ...string) *redis.IntCmd
- func (p *Pool) SInter(keys ...string) *redis.StringSliceCmd
- func (p *Pool) SInterStore(destination string, keys ...string) *redis.IntCmd
- func (p *Pool) SIsMember(key string, member interface{}) *redis.BoolCmd
- func (p *Pool) SMembers(key string) *redis.StringSliceCmd
- func (p *Pool) SMembersMap(key string) *redis.StringStructMapCmd
- func (p *Pool) SMove(source, destination string, member interface{}) *redis.BoolCmd
- func (p *Pool) SPop(key string) *redis.StringCmd
- func (p *Pool) SPopN(key string, count int64) *redis.StringSliceCmd
- func (p *Pool) SRandMember(key string) *redis.StringCmd
- func (p *Pool) SRandMemberN(key string, count int64) *redis.StringSliceCmd
- func (p *Pool) SRem(key string, members ...interface{}) *redis.IntCmd
- func (p *Pool) SScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (p *Pool) SUnion(keys ...string) *redis.StringSliceCmd
- func (p *Pool) SUnionStore(destination string, keys ...string) *redis.IntCmd
- func (p *Pool) Scan(cursor uint64, match string, count int64) *redis.ScanCmd
- func (p *Pool) ScriptExists(hashes ...string) *redis.BoolSliceCmd
- func (p *Pool) ScriptFlush() *redis.StatusCmd
- func (p *Pool) ScriptKill() *redis.StatusCmd
- func (p *Pool) ScriptLoad(script string) *redis.StringCmd
- func (p *Pool) Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- func (p *Pool) SetBit(key string, offset int64, value int) *redis.IntCmd
- func (p *Pool) SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd
- func (p *Pool) SetRange(key string, offset int64, value string) *redis.IntCmd
- func (p *Pool) SetXX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd
- func (p *Pool) Sort(key string, sort *redis.Sort) *redis.StringSliceCmd
- func (p *Pool) SortInterfaces(key string, sort *redis.Sort) *redis.SliceCmd
- func (p *Pool) SortStore(key, store string, sort *redis.Sort) *redis.IntCmd
- func (p *Pool) StrLen(key string) *redis.IntCmd
- func (p *Pool) TTL(key string) *redis.DurationCmd
- func (p *Pool) Touch(keys ...string) (int64, error)
- func (p *Pool) TxPipeline() (redis.Pipeliner, error)
- func (p *Pool) TxPipelined(fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
- func (p *Pool) Type(key string) *redis.StatusCmd
- func (p *Pool) Unlink(keys ...string) (int64, error)
- func (p *Pool) WithMaster(key ...string) (*redis.Client, error)
- func (p *Pool) ZAdd(key string, members ...*redis.Z) *redis.IntCmd
- func (p *Pool) ZAddCh(key string, members ...*redis.Z) *redis.IntCmd
- func (p *Pool) ZAddNX(key string, members ...*redis.Z) *redis.IntCmd
- func (p *Pool) ZAddNXCh(key string, members ...*redis.Z) *redis.IntCmd
- func (p *Pool) ZAddXX(key string, members ...*redis.Z) *redis.IntCmd
- func (p *Pool) ZAddXXCh(key string, members ...*redis.Z) *redis.IntCmd
- func (p *Pool) ZCard(key string) *redis.IntCmd
- func (p *Pool) ZCount(key, min, max string) *redis.IntCmd
- func (p *Pool) ZIncr(key string, member *redis.Z) *redis.FloatCmd
- func (p *Pool) ZIncrBy(key string, increment float64, member string) *redis.FloatCmd
- func (p *Pool) ZIncrNX(key string, member *redis.Z) *redis.FloatCmd
- func (p *Pool) ZIncrXX(key string, member *redis.Z) *redis.FloatCmd
- func (p *Pool) ZInterStore(destination string, store *redis.ZStore) *redis.IntCmd
- func (p *Pool) ZLexCount(key, min, max string) *redis.IntCmd
- func (p *Pool) ZPopMax(key string, count ...int64) *redis.ZSliceCmd
- func (p *Pool) ZPopMin(key string, count ...int64) *redis.ZSliceCmd
- func (p *Pool) ZRange(key string, start, stop int64) *redis.StringSliceCmd
- func (p *Pool) ZRangeByLex(key string, opt *redis.ZRangeBy) *redis.StringSliceCmd
- func (p *Pool) ZRangeByScore(key string, opt *redis.ZRangeBy) *redis.StringSliceCmd
- func (p *Pool) ZRangeByScoreWithScores(key string, opt *redis.ZRangeBy) *redis.ZSliceCmd
- func (p *Pool) ZRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
- func (p *Pool) ZRank(key, member string) *redis.IntCmd
- func (p *Pool) ZRem(key string, members ...interface{}) *redis.IntCmd
- func (p *Pool) ZRemRangeByLex(key, min, max string) *redis.IntCmd
- func (p *Pool) ZRemRangeByRank(key string, start, stop int64) *redis.IntCmd
- func (p *Pool) ZRemRangeByScore(key, min, max string) *redis.IntCmd
- func (p *Pool) ZRevRange(key string, start, stop int64) *redis.StringSliceCmd
- func (p *Pool) ZRevRangeByLex(key string, opt *redis.ZRangeBy) *redis.StringSliceCmd
- func (p *Pool) ZRevRangeByScore(key string, opt *redis.ZRangeBy) *redis.StringSliceCmd
- func (p *Pool) ZRevRangeByScoreWithScores(key string, opt *redis.ZRangeBy) *redis.ZSliceCmd
- func (p *Pool) ZRevRangeWithScores(key string, start, stop int64) *redis.ZSliceCmd
- func (p *Pool) ZRevRank(key, member string) *redis.IntCmd
- func (p *Pool) ZScan(key string, cursor uint64, match string, count int64) *redis.ScanCmd
- func (p *Pool) ZScore(key, member string) *redis.FloatCmd
- func (p *Pool) ZUnionStore(dest string, store *redis.ZStore) *redis.IntCmd
- type ShardConfig
- type ShardConnFactory
Constants ¶
View Source
const ( // PollByRandom selects the slave factory by random index PollByRandom = iota + 1 // PollByWeight selects the slave factory by weight PollByWeight // PollByRoundRobin selects the slave with round-robin order PollByRoundRobin )
View Source
const ( // DistributeByModular selects the sharding factory by modular DistributeByModular = iota + 1 // DistributeByKetama selects the sharding factory by ketama consistent algorithm DistributeByKetama )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnFactory ¶
type ConnFactory interface {
// contains filtered or unexported methods
}
type HAConfig ¶
type HAConfig struct { Master string // the address of the master, e.g. "127.0.0.1:6379" Slaves []string // list of slaves, e.g. ["127.0.0.1:6379", "127.0.0.1:6380"] Password string // the password of the master ReadonlyPassword string // the passsword of slaves Options *redis.Options // redis options PollType int // the slave polling type AutoEjectHost bool // eject the failure host or not ServerFailureLimit int32 // eject if reached `ServerFailureLimit` times of failure ServerRetryTimeout time.Duration // retry the ejected host after `ServerRetryTimeout` MinServerNum int // reserved the min server // contains filtered or unexported fields }
type HAConnFactory ¶
type HAConnFactory struct {
// contains filtered or unexported fields
}
HAConnFactory impls the read/write splits between master and slaves
func NewHAConnFactory ¶
func NewHAConnFactory(cfg *HAConfig) (*HAConnFactory, error)
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewShard ¶
func NewShard(cfg *ShardConfig) (*Pool, error)
func (*Pool) BRPopLPush ¶
func (*Pool) GeoRadius ¶
func (p *Pool) GeoRadius(key string, longitude, latitude float64, query *redis.GeoRadiusQuery) *redis.GeoLocationCmd
func (*Pool) GeoRadiusByMember ¶
func (p *Pool) GeoRadiusByMember(key, member string, query *redis.GeoRadiusQuery) *redis.GeoLocationCmd
func (*Pool) GeoRadiusByMemberStore ¶
func (*Pool) GeoRadiusStore ¶
func (*Pool) HIncrByFloat ¶
func (*Pool) LInsertAfter ¶
func (*Pool) LInsertBefore ¶
func (*Pool) MSet ¶
MSet is like Set but accepts multiple values:
- MSet("key1", "value1", "key2", "value2")
- MSet([]string{"key1", "value1", "key2", "value2"})
- MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (*Pool) MSetNX ¶
MSetNX is like SetNX but accepts multiple values:
- MSetNX("key1", "value1", "key2", "value2")
- MSetNX([]string{"key1", "value1", "key2", "value2"})
- MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (*Pool) ObjectIdleTime ¶
func (p *Pool) ObjectIdleTime(key string) *redis.DurationCmd
func (*Pool) PubSubChannels ¶
func (p *Pool) PubSubChannels(pattern string) *redis.StringSliceCmd
func (*Pool) PubSubNumPat ¶
func (*Pool) PubSubNumSub ¶
func (p *Pool) PubSubNumSub(channels ...string) *redis.StringIntMapCmd
func (*Pool) SDiffStore ¶
func (*Pool) SInterStore ¶
func (*Pool) SMembersMap ¶
func (p *Pool) SMembersMap(key string) *redis.StringStructMapCmd
func (*Pool) SRandMemberN ¶
func (p *Pool) SRandMemberN(key string, count int64) *redis.StringSliceCmd
func (*Pool) SUnionStore ¶
func (*Pool) ScriptExists ¶
func (p *Pool) ScriptExists(hashes ...string) *redis.BoolSliceCmd
func (*Pool) ScriptFlush ¶
func (*Pool) ScriptKill ¶
func (*Pool) SortInterfaces ¶
func (*Pool) TxPipelined ¶
func (*Pool) ZInterStore ¶
func (*Pool) ZRangeByLex ¶
func (*Pool) ZRangeByScore ¶
func (*Pool) ZRangeByScoreWithScores ¶
func (*Pool) ZRangeWithScores ¶
func (*Pool) ZRemRangeByRank ¶
func (*Pool) ZRevRange ¶
func (p *Pool) ZRevRange(key string, start, stop int64) *redis.StringSliceCmd
func (*Pool) ZRevRangeByLex ¶
func (*Pool) ZRevRangeByScore ¶
func (*Pool) ZRevRangeByScoreWithScores ¶
func (*Pool) ZRevRangeWithScores ¶
type ShardConfig ¶
type ShardConnFactory ¶
type ShardConnFactory struct {
// contains filtered or unexported fields
}
func NewShardConnFactory ¶
func NewShardConnFactory(cfg *ShardConfig) (*ShardConnFactory, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.