Documentation ¶
Index ¶
- type Config
- type Pool
- func (p *Pool) Close() error
- func (p *Pool) Del(key string) error
- func (p *Pool) DoScript(keyCount int, src string, keysAndArgs ...interface{}) (interface{}, error)
- func (p *Pool) Expire(key string, ttl int32) error
- func (p *Pool) ExpireAt(key string, expireTime time.Time) error
- func (p *Pool) Get(key string) (reply interface{}, err error)
- func (p *Pool) HDel(key string, field string) error
- func (p *Pool) HGet(key string, field string) (interface{}, error)
- func (p *Pool) HGetall(key string) (interface{}, error)
- func (p *Pool) HIncr(key string, field string, addValue int64) (int64, error)
- func (p *Pool) HMDel(key string, fields []string) (interface{}, error)
- func (p *Pool) HMGet(key string, fields []string) (interface{}, error)
- func (p *Pool) HMSet(key string, fields map[string]interface{}) error
- func (p *Pool) HSet(key string, field string, value interface{}) error
- func (p *Pool) Hkeys(key string) (interface{}, error)
- func (p *Pool) INCR(key string, addValue int64) (int64, error)
- func (p *Pool) Keys(pattern string) (interface{}, error)
- func (p *Pool) Llen(key string) (int64, error)
- func (p *Pool) Lpush(key string, val interface{}) error
- func (p *Pool) MDel(keys []string) error
- func (p *Pool) MGet(keys []string) (reply interface{}, err error)
- func (p *Pool) MSet(vals map[string]interface{}) error
- func (p *Pool) NewMutex(name string, options ...redsync.Option) *redsync.Mutex
- func (p *Pool) Ping() error
- func (p *Pool) Pool() *redis.Pool
- func (p *Pool) Rename(oldKey string, newKey string) error
- func (p *Pool) RenameEx(oldKey string, newKey string) error
- func (p *Pool) Rpop(key string) (reply interface{}, err error)
- func (p *Pool) Scan(pattern string, count int64) ([]interface{}, error)
- func (p *Pool) Set(key string, val interface{}) error
- func (p *Pool) SetEx(key string, ttl int32, val interface{}) error
- func (p *Pool) UnlockMutex(mutex *redsync.Mutex) (err error)
- type RedisClient
- type RedisMode
- type Sentinel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Mode RedisMode `default:"NormalDsn"` // 模式,支持NormalDsn、NormalAddr、Sentinel IsNeedFillDefault bool // 是否需要填充默认参数 // dial Dsn string // 用于NormalDsn模式 Addr string // redis地址,用于NormalAddr模式 Password string // redis密码 Db int // db库 ConnectTimeout time.Duration `default:"3s"` ReadTimeout time.Duration `default:"3s"` WriteTimeout time.Duration `default:"3s"` // pool MaxIdle int `default:"3"` MaxActive int `default:"64"` IdleTimeout time.Duration `default:"240s"` // sentinel Sentinel *Sentinel // 用于Sentinel }
Config Redis的配置
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool redis connection struct
func NewPool ¶
NewPool 初始化redis连接池结构 c.Addr like: redis://user:secret@localhost:6379/0?foo=bar&qux=baz
func (*Pool) UnlockMutex ¶
type RedisClient ¶
type RedisClient interface { Close() error Ping() error Get(key string) (interface{}, error) MGet(keys []string) (interface{}, error) Set(key string, value interface{}) error SetEx(key string, ttl int32, value interface{}) error MSet(vals map[string]interface{}) error Del(key string) error MDel(keys []string) error INCR(key string, addValue int64) (int64, error) Expire(key string, ttl int32) error ExpireAt(key string, expireTime time.Time) error HSet(key string, field string, value interface{}) error HMSet(key string, fields map[string]interface{}) error HDel(key string, field string) error HMDel(key string, fields []string) (interface{}, error) HGet(key string, field string) (interface{}, error) HMGet(key string, fields []string) (interface{}, error) HGetall(key string) (interface{}, error) Hkeys(key string) (interface{}, error) HIncr(key string, field string, addValue int64) (int64, error) Keys(pattern string) (interface{}, error) Scan(pattern string, count int64) ([]interface{}, error) DoScript(keyCount int, src string, keysAndArgs ...interface{}) (interface{}, error) NewMutex(name string, options ...redsync.Option) *redsync.Mutex UnlockMutex(mutex *redsync.Mutex) error Rename(oldKey string, newKey string) error RenameEx(oldKey string, newKey string) error Lpush(key string, val interface{}) error Rpop(key string) (interface{}, error) Llen(key string) (int64, error) }
func NewRedisClient ¶
func NewRedisClient(conf *Config) (RedisClient, error)
Click to show internal directories.
Click to hide internal directories.