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) string
- func (rds RedisClient) Has(key string) bool
- func (rds RedisClient) Increment(parameters ...interface{}) bool
- func (rds RedisClient) Ping() error
- 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 NewClient ¶
func NewClient(address string, username string, password string, db int) *RedisClient
NewClient 创建一个新的 redis 连接
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) 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 类型。
Click to show internal directories.
Click to hide internal directories.