Documentation ¶
Index ¶
- type MyRedis
- type Option
- func WithAddr(addr ...string) Option
- func WithClientName(name string) Option
- func WithDB(db int) Option
- func WithGroupName(groupName string) Option
- func WithLog(isLog bool) Option
- func WithPool(maxIdle, maxActive int) Option
- func WithPwd(pwd string) Option
- func WithReadTimeout(timeout time.Duration) Option
- func WithTimeout(timeout time.Duration) Option
- func WithWriteTimeout(timeout time.Duration) Option
- type RedisDial
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MyRedis ¶
type MyRedis struct {
// contains filtered or unexported fields
}
MyRedis redis配置项
func InitDefaultRedis ¶
InitDefaultRedis 初始化(必须要优先调用一次)
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option 功能选项
func WithWriteTimeout ¶
WithWriteTimeout 设置写过期时间
type RedisDial ¶
type RedisDial interface { Destory() // 析构 GetRedisClient() redis.Conn // 获取一个原始的redis连接 Ping() bool // 判断是否能ping通 Add(key interface{}, value interface{}, lifeSpan time.Duration) error // 添加一个元素 Value(key interface{}, value interface{}) error // 获取一个value IsExist(key interface{}) bool // 判断是否存在 Delete(key interface{}) error // 删除一个 Clear() error // 清空 GetKeyS(key interface{}) ([]string, error) // 查询所有key Close() (err error) // 关闭连接 Do(commandName string, args ...interface{}) (reply interface{}, err error) // 一次操作 TryLock(key interface{}, value interface{}, lifeSpan time.Duration) (err error) // 试着加锁 Unlock(key interface{}) (err error) // 解锁 Refresh(key interface{}, lifeSpan time.Duration) error // 更新时间 }
RedisDial 操作
Click to show internal directories.
Click to hide internal directories.