Documentation ¶
Overview ¶
Package redis 工具包
Index ¶
- func ConnectRedis(address string, username string, password string, db int)
- type RedisClient
- func (rds RedisClient) Decrement(parameters ...interface{}) bool
- func (rds RedisClient) Del(keys ...string) bool
- func (rds RedisClient) FlushDB() bool
- func (rds RedisClient) Get(key string, model interface{}) error
- func (rds RedisClient) GetAwaitSendKey(iccid, slaveId string, markType string, groupId int) string
- func (rds RedisClient) GetDeviceKey(iccid string) string
- func (rds RedisClient) GetPropertyKey() string
- func (rds RedisClient) GetSlaveKey(iccid string) string
- func (rds RedisClient) HGet(key, field string, model interface{}) error
- func (rds RedisClient) HGetAll(key string, model interface{}) error
- func (rds RedisClient) HMSet(key string, model interface{})
- func (rds RedisClient) HSet(key, field string, model interface{})
- func (rds RedisClient) Has(key string) bool
- func (rds RedisClient) Increment(parameters ...interface{}) bool
- func (rds RedisClient) Lpop(key string) string
- func (rds RedisClient) Ping() error
- func (rds RedisClient) Rpush(key string, value interface{}) bool
- func (rds RedisClient) Set(key string, value interface{}, expiration time.Duration) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RedisClient ¶
RedisClient Redis 服务
var Redis *RedisClient
Redis 全局 Redis,使用 db 1
func (RedisClient) Decrement ¶
func (rds RedisClient) Decrement(parameters ...interface{}) bool
Decrement 当参数只有 1 个时,为 key,其值减去 1。 当参数有 2 个时,第一个参数为 key ,第二个参数为要减去的值 int64 类型。
func (RedisClient) Del ¶
func (rds RedisClient) Del(keys ...string) bool
Del 删除存储在 redis 里的数据,支持多个 key 传参
func (RedisClient) Get ¶
func (rds RedisClient) Get(key string, model interface{}) error
Get 获取 key 对应的 value
func (RedisClient) GetAwaitSendKey ¶
func (rds RedisClient) GetAwaitSendKey(iccid, slaveId string, markType string, groupId int) string
func (RedisClient) GetDeviceKey ¶
func (rds RedisClient) GetDeviceKey(iccid string) string
func (RedisClient) GetPropertyKey ¶
func (rds RedisClient) GetPropertyKey() string
func (RedisClient) GetSlaveKey ¶
func (rds RedisClient) GetSlaveKey(iccid string) string
func (RedisClient) HGet ¶
func (rds RedisClient) HGet(key, field string, model interface{}) error
func (RedisClient) HGetAll ¶
func (rds RedisClient) HGetAll(key string, model interface{}) error
func (RedisClient) HMSet ¶
func (rds RedisClient) HMSet(key string, model interface{})
func (RedisClient) HSet ¶
func (rds RedisClient) HSet(key, field string, model interface{})
func (RedisClient) Has ¶
func (rds RedisClient) Has(key string) bool
Has 判断一个 key 是否存在,内部错误和 redis.Nil 都返回 false
func (RedisClient) Increment ¶
func (rds RedisClient) Increment(parameters ...interface{}) bool
Increment 当参数只有 1 个时,为 key,其值增加 1。 当参数有 2 个时,第一个参数为 key ,第二个参数为要增加的值 int64 类型。
func (RedisClient) Rpush ¶
func (rds RedisClient) Rpush(key string, value interface{}) bool
Rpush 写入队列
Click to show internal directories.
Click to hide internal directories.