Documentation
¶
Index ¶
- Constants
- func IsNil(err error) bool
- func TimeOutCtx(timeout int64) (context.Context, context.CancelFunc)
- type DB
- func (c *DB) Close() error
- func (c *DB) Decr(key string) *redis.IntCmd
- func (c *DB) DecrBy(key string, decrement int64) *redis.IntCmd
- func (c *DB) Del(key string, options ...OptionHandler) bool
- func (c *DB) Exists(keys ...string) bool
- func (c *DB) Expire(key string, ttl time.Duration) bool
- func (c *DB) ExpireAt(key string, ttl time.Time) bool
- func (c *DB) Get(key string, options ...OptionHandler) (string, error)
- func (c *DB) GetBit(key string, offset int64) *redis.IntCmd
- func (c *DB) GetConn() *redis.Client
- func (c *DB) GetDel(key string) *redis.StringCmd
- func (c *DB) GetEx(key string, expiration time.Duration) *redis.StringCmd
- func (c *DB) GetRange(key string, start int64, end int64) *redis.StringCmd
- func (c *DB) GetSet(key string, value interface{}) *redis.StringCmd
- func (c *DB) HDel(key string, fields ...string) *redis.IntCmd
- func (c *DB) HExists(key string, field string) *redis.BoolCmd
- func (c *DB) HGet(key string, field string) *redis.StringCmd
- func (c *DB) HGetAll(key string) *redis.MapStringStringCmd
- func (c *DB) HIncrBy(key string, field string, incr int64) *redis.IntCmd
- func (c *DB) HIncrByFloat(key string, field string, incr float64) *redis.FloatCmd
- func (c *DB) HKeys(key string) *redis.StringSliceCmd
- func (c *DB) HLen(key string) *redis.IntCmd
- func (c *DB) HMGet(key string, fields ...string) *redis.SliceCmd
- func (c *DB) HMSet(key string, values ...interface{}) *redis.BoolCmd
- func (c *DB) HSet(key string, values ...interface{}) *redis.IntCmd
- func (c *DB) HSetNX(key string, field string, value interface{}) *redis.BoolCmd
- func (c *DB) Incr(key string, options ...OptionHandler) int64
- func (c *DB) IncrBy(key string, value int64) *redis.IntCmd
- func (c *DB) IncrByFloat(key string, value float64) *redis.FloatCmd
- func (c *DB) Keys(pattern string) *redis.StringSliceCmd
- func (c *DB) LIndex(key string, index int64) *redis.StringCmd
- func (c *DB) LInsert(key string, op string, pivot interface{}, value interface{}) *redis.IntCmd
- func (c *DB) LInsertAfter(key string, pivot interface{}, value interface{}) *redis.IntCmd
- func (c *DB) LInsertBefore(key string, pivot interface{}, value interface{}) *redis.IntCmd
- func (c *DB) LLen(key string) *redis.IntCmd
- func (c *DB) LMove(source string, destination string, srcpos string, destpos string) *redis.StringCmd
- func (c *DB) LPop(key string) *redis.StringCmd
- func (c *DB) LPopCount(key string, count int) *redis.StringSliceCmd
- func (c *DB) LPos(key string, value string, a redis.LPosArgs) *redis.IntCmd
- func (c *DB) LPosCount(key string, value string, count int64, a redis.LPosArgs) *redis.IntSliceCmd
- func (c *DB) LPush(key string, values ...interface{}) *redis.IntCmd
- func (c *DB) LPushX(key string, values ...interface{}) *redis.IntCmd
- func (c *DB) LRange(key string, start int64, stop int64) *redis.StringSliceCmd
- func (c *DB) LRem(key string, count int64, value interface{}) *redis.IntCmd
- func (c *DB) LSet(key string, index int64, value interface{}) *redis.StatusCmd
- func (c *DB) LTrim(key string, start int64, stop int64) *redis.StatusCmd
- func (c *DB) MGet(keys ...string) *redis.SliceCmd
- func (c *DB) MSet(values ...interface{}) *redis.StatusCmd
- func (c *DB) MSetNX(values ...interface{}) *redis.BoolCmd
- func (c *DB) Move(key string, db int) *redis.BoolCmd
- func (c *DB) Publish(channel string, message interface{}) (int64, error)
- func (c *DB) RPop(key string) *redis.StringCmd
- func (c *DB) RPopCount(key string, count int) *redis.StringSliceCmd
- func (c *DB) RPopLPush(source string, destination string) *redis.StringCmd
- func (c *DB) RPush(key string, values ...interface{}) *redis.IntCmd
- func (c *DB) RPushX(key string, values ...interface{}) *redis.IntCmd
- func (c *DB) SAdd(key string, members ...interface{}) *redis.IntCmd
- func (c *DB) SCard(key string) *redis.IntCmd
- func (c *DB) SIsMember(key string, member interface{}) *redis.BoolCmd
- func (c *DB) SMembers(key string) *redis.StringSliceCmd
- func (c *DB) SPop(key string) *redis.StringCmd
- func (c *DB) SPopN(key string, count int64) *redis.StringSliceCmd
- func (c *DB) SRem(key string, members ...interface{}) *redis.IntCmd
- func (c *DB) Set(key, value string, ttl time.Duration, options ...OptionHandler) error
- func (c *DB) SetBit(key string, offset int64, value int) *redis.IntCmd
- func (c *DB) SetEX(key string, value interface{}, expiration time.Duration) *redis.StatusCmd
- func (c *DB) SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd
- func (c *DB) Sort(key string, sort *redis.Sort) *redis.StringSliceCmd
- func (c *DB) SortInterfaces(key string, sort *redis.Sort) *redis.SliceCmd
- func (c *DB) SortStore(key string, store string, sort *redis.Sort) *redis.IntCmd
- func (c *DB) Subscribe(handler SubHandler, channels ...string) error
- func (c *DB) TTL(key string) (time.Duration, error)
- func (c *DB) ZAddNX(key string, members ...redis.Z) *redis.IntCmd
- func (c *DB) ZAddXX(key string, members ...redis.Z) *redis.IntCmd
- func (c *DB) ZCard(key string) *redis.IntCmd
- func (c *DB) ZCount(key, min, max string) *redis.IntCmd
- func (c *DB) ZIncrBy(key string, increment float64, member string) *redis.FloatCmd
- func (c *DB) ZInter(store *redis.ZStore) *redis.StringSliceCmd
- func (c *DB) ZInterStore(destination string, store *redis.ZStore) *redis.IntCmd
- func (c *DB) ZInterWithScores(store *redis.ZStore) *redis.ZSliceCmd
- func (c *DB) ZLexCount(key, min, max string) *redis.IntCmd
- func (c *DB) ZMScore(key string, members ...string) *redis.FloatSliceCmd
- func (c *DB) ZPopMax(key string, count ...int64) *redis.ZSliceCmd
- func (c *DB) ZPopMin(key string, count ...int64) *redis.ZSliceCmd
- func (c *DB) ZRem(key string, members ...interface{}) *redis.IntCmd
- type Info
- type OptionHandler
- type Repo
- type SentinelInfo
- type SubHandler
- type Trace
Constants ¶
View Source
const DefaultTimeOut = 10
DefaultTimeOut 默认超时时间10秒
Variables ¶
This section is empty.
Functions ¶
func TimeOutCtx ¶
func TimeOutCtx(timeout int64) (context.Context, context.CancelFunc)
Types ¶
type DB ¶
func (*DB) Get ¶
func (c *DB) Get(key string, options ...OptionHandler) (string, error)
Get get some key from redis
func (*DB) HIncrByFloat ¶
func (*DB) LInsertAfter ¶
func (*DB) LInsertBefore ¶
func (*DB) SortInterfaces ¶
func (*DB) ZInterStore ¶
type Info ¶
type Info struct { Addr string `toml:"Addr" json:"Addr"` Pass string `toml:"Pass" json:"Pass"` Db int `toml:"Db" json:"Db"` MaxRetries int `toml:"MaxRetries" json:"MaxRetries"` PoolSize int `toml:"PoolSize" json:"PoolSize"` MinIDleConns int `toml:"MinIDleConns" json:"MinIDleConns"` // 超时时间, 单位秒. 拨号超时, 读写超时采用同一个配置. TimeOut int64 `toml:"TimeOut" json:"TimeOut"` // redis哨兵相关配置 Sentinel SentinelInfo `toml:"Sentinel" json:"Sentinel"` }
type OptionHandler ¶
type OptionHandler func(*option)
type Repo ¶
type Repo interface { Set(key, value string, ttl time.Duration, options ...OptionHandler) error Get(key string, options ...OptionHandler) (string, error) TTL(key string) (time.Duration, error) Expire(key string, ttl time.Duration) bool ExpireAt(key string, ttl time.Time) bool Del(key string, options ...OptionHandler) bool Exists(keys ...string) bool Incr(key string, options ...OptionHandler) int64 Close() error GetConn() *redis.Client // Publish 发布消息 Publish(channel string, message interface{}) (int64, error) // Subscribe 订阅消息 Subscribe(handler SubHandler, channels ...string) error Keys(pattern string) *redis.StringSliceCmd Move(key string, db int) *redis.BoolCmd Sort(key string, sort *redis.Sort) *redis.StringSliceCmd SortStore(key string, store string, sort *redis.Sort) *redis.IntCmd SortInterfaces(key string, sort *redis.Sort) *redis.SliceCmd Decr(key string) *redis.IntCmd DecrBy(key string, decrement int64) *redis.IntCmd GetRange(key string, start int64, end int64) *redis.StringCmd GetSet(key string, value interface{}) *redis.StringCmd GetEx(key string, expiration time.Duration) *redis.StringCmd GetDel(key string) *redis.StringCmd IncrBy(key string, value int64) *redis.IntCmd IncrByFloat(key string, value float64) *redis.FloatCmd MGet(keys ...string) *redis.SliceCmd MSet(values ...interface{}) *redis.StatusCmd MSetNX(values ...interface{}) *redis.BoolCmd SetEX(key string, value interface{}, expiration time.Duration) *redis.StatusCmd SetNX(key string, value interface{}, expiration time.Duration) *redis.BoolCmd GetBit(key string, offset int64) *redis.IntCmd SetBit(key string, offset int64, value int) *redis.IntCmd HDel(key string, fields ...string) *redis.IntCmd HExists(key string, field string) *redis.BoolCmd HGet(key string, field string) *redis.StringCmd HGetAll(key string) *redis.MapStringStringCmd HIncrBy(key string, field string, incr int64) *redis.IntCmd HIncrByFloat(key string, field string, incr float64) *redis.FloatCmd HKeys(key string) *redis.StringSliceCmd HLen(key string) *redis.IntCmd HMGet(key string, fields ...string) *redis.SliceCmd HSet(key string, values ...interface{}) *redis.IntCmd HMSet(key string, values ...interface{}) *redis.BoolCmd HSetNX(key string, field string, value interface{}) *redis.BoolCmd LIndex(key string, index int64) *redis.StringCmd LInsert(key string, op string, pivot interface{}, value interface{}) *redis.IntCmd LInsertBefore(key string, pivot interface{}, value interface{}) *redis.IntCmd LInsertAfter(key string, pivot interface{}, value interface{}) *redis.IntCmd LLen(key string) *redis.IntCmd LPop(key string) *redis.StringCmd LPopCount(key string, count int) *redis.StringSliceCmd LPos(key string, value string, a redis.LPosArgs) *redis.IntCmd LPosCount(key string, value string, count int64, a redis.LPosArgs) *redis.IntSliceCmd LPush(key string, values ...interface{}) *redis.IntCmd LPushX(key string, values ...interface{}) *redis.IntCmd LRange(key string, start int64, stop int64) *redis.StringSliceCmd LRem(key string, count int64, value interface{}) *redis.IntCmd LSet(key string, index int64, value interface{}) *redis.StatusCmd LTrim(key string, start int64, stop int64) *redis.StatusCmd RPop(key string) *redis.StringCmd RPopCount(key string, count int) *redis.StringSliceCmd RPopLPush(source string, destination string) *redis.StringCmd RPush(key string, values ...interface{}) *redis.IntCmd RPushX(key string, values ...interface{}) *redis.IntCmd LMove(source string, destination string, srcpos string, destpos string) *redis.StringCmd SAdd(key string, members ...interface{}) *redis.IntCmd SCard(key string) *redis.IntCmd SIsMember(key string, member interface{}) *redis.BoolCmd SMembers(key string) *redis.StringSliceCmd SPop(key string) *redis.StringCmd SPopN(key string, count int64) *redis.StringSliceCmd SRem(key string, members ...interface{}) *redis.IntCmd ZAddNX(key string, members ...redis.Z) *redis.IntCmd ZAddXX(key string, members ...redis.Z) *redis.IntCmd ZCard(key string) *redis.IntCmd ZRem(key string, members ...interface{}) *redis.IntCmd ZCount(key, min, max string) *redis.IntCmd ZLexCount(key, min, max string) *redis.IntCmd ZIncrBy(key string, increment float64, member string) *redis.FloatCmd ZInterStore(destination string, store *redis.ZStore) *redis.IntCmd ZInter(store *redis.ZStore) *redis.StringSliceCmd ZInterWithScores(store *redis.ZStore) *redis.ZSliceCmd ZMScore(key string, members ...string) *redis.FloatSliceCmd ZPopMax(key string, count ...int64) *redis.ZSliceCmd ZPopMin(key string, count ...int64) *redis.ZSliceCmd }
type SentinelInfo ¶
type SubHandler ¶
Click to show internal directories.
Click to hide internal directories.