Documentation
¶
Index ¶
- Constants
- func LoadClient(conf utils.RedisConf) error
- type RedisClient
- func (c *RedisClient) Conn() (redis.Conn, error)
- func (c *RedisClient) Csadd(key string, members ...interface{}) (added bool, err error)
- func (c *RedisClient) Csismember(key string, item interface{}) (ok bool, err error)
- func (c *RedisClient) Csmembers(key string, out interface{}) (err error)
- func (c *RedisClient) Del(key string) (interface{}, error)
- func (c *RedisClient) Do(commandName string, args ...interface{}) (interface{}, error)
- func (c *RedisClient) Expire(key string, second int) (err error)
- func (c *RedisClient) FullKey(key string) string
- func (c *RedisClient) Get(key string) (interface{}, error)
- func (c *RedisClient) GetBytes(key string, def []byte) ([]byte, error)
- func (c *RedisClient) GetGlob(key string, out interface{}) error
- func (c *RedisClient) GetInt(key string, def int) (int, error)
- func (c *RedisClient) GetInt64(key string, def int64) (int64, error)
- func (c *RedisClient) Incr(key string) (int64, error)
- func (c *RedisClient) IncrBy(key string, increment int) (int64, error)
- func (c *RedisClient) Set(key string, value interface{}, opts ...interface{}) (interface{}, error)
- func (c *RedisClient) SetGlob(key string, ptr interface{}) error
- type RedisMutex
Constants ¶
View Source
const (
REDIS_UNIQUE_ID_KEY = "REDIS_UNIQUE_ID_KEY"
)
Variables ¶
This section is empty.
Functions ¶
func LoadClient ¶
func LoadClient(conf utils.RedisConf) error
Types ¶
type RedisClient ¶
type RedisClient struct { Config utils.RedisConf // contains filtered or unexported fields }
一般我们在一个系统里面使用redis 所以该Client下的基本命令都会自动追加Prefix
var MainClient *RedisClient
func (*RedisClient) Csadd ¶
func (c *RedisClient) Csadd(key string, members ...interface{}) (added bool, err error)
SADD
func (*RedisClient) Csismember ¶
func (c *RedisClient) Csismember(key string, item interface{}) (ok bool, err error)
SISMEMBER
func (*RedisClient) Csmembers ¶
func (c *RedisClient) Csmembers(key string, out interface{}) (err error)
SMEMBERS
func (*RedisClient) Del ¶
func (c *RedisClient) Del(key string) (interface{}, error)
func (*RedisClient) Do ¶
func (c *RedisClient) Do(commandName string, args ...interface{}) (interface{}, error)
func (*RedisClient) Expire ¶
func (c *RedisClient) Expire(key string, second int) (err error)
EXPIRE
func (*RedisClient) Get ¶
func (c *RedisClient) Get(key string) (interface{}, error)
func (*RedisClient) GetBytes ¶
func (c *RedisClient) GetBytes(key string, def []byte) ([]byte, error)
func (*RedisClient) GetGlob ¶
func (c *RedisClient) GetGlob(key string, out interface{}) error
func (*RedisClient) Set ¶
func (c *RedisClient) Set(key string, value interface{}, opts ...interface{}) (interface{}, error)
func (*RedisClient) SetGlob ¶
func (c *RedisClient) SetGlob(key string, ptr interface{}) error
gob.Register
type RedisMutex ¶
type RedisMutex struct {
// contains filtered or unexported fields
}
func NewRedisMutex ¶
func NewRedisMutex(name string, timeout int) *RedisMutex
简陋redis锁 name: 锁的key timeout: 过期秒数
func (*RedisMutex) Lock ¶
func (m *RedisMutex) Lock() bool
func (*RedisMutex) Unlock ¶
func (m *RedisMutex) Unlock()
Click to show internal directories.
Click to hide internal directories.