Documentation ¶
Index ¶
- Constants
- func Init()
- func RegisterRedis()
- type Config
- type Iterator
- type MResult
- type Operation
- type Operations
- type RedisClient
- func (c *RedisClient) Del(key string) *Result
- func (c *RedisClient) Get(key string) *Result
- func (c *RedisClient) Inrc(key string) *Result
- func (c *RedisClient) Lock(key string, acquire, timeout time.Duration) (string, error)
- func (c *RedisClient) MGet(key string) *MResult
- func (c *RedisClient) Set(key string, value interface{}, ops ...*Operation) *Result
- func (c *RedisClient) UnLock(key, code string) bool
- type Result
Constants ¶
View Source
const ( // EXPIRE 过期时间 EXPIRE = "expire" // NX 如果不存在,则 SET NX = "nx" // XX 如果存在,则 SET XX = "xx" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Name string `mapstructure:"name"` Conn string `mapstructure:"conn"` Password string `mapstructure:"password"` Timeout int `mapstructure:"timeout"` DB int `mapstructure:"db"` }
Config Redis配置信息
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
RedisClient Redis客户端
func (*RedisClient) Set ¶
func (c *RedisClient) Set(key string, value interface{}, ops ...*Operation) *Result
Set 将字符串值 value 关联到 key
func (*RedisClient) UnLock ¶ added in v0.2.1
func (c *RedisClient) UnLock(key, code string) bool
UnLock 释放分布式锁
Click to show internal directories.
Click to hide internal directories.