Documentation
¶
Index ¶
- func Del(keys ...string)
- func Expire(key string, timeout int) (bool, error)
- func Get(key string) (string, error)
- func GetExpire(key string) (int, error)
- func GetIndex(key string, index int) (string, error)
- func GetList(key string, start, stop int64) ([]string, error)
- func GetListSize(key string) (int64, error)
- func GetStruct(key string, target interface{}) error
- func HDel(key string, item ...string)
- func HGet(key string, item string) (string, error)
- func HGetAll(key string) (map[string]string, error)
- func HHasKey(key string, item string) (bool, error)
- func HIncr(key string, item string, by int64) (int64, error)
- func HMGet(key string, item ...string) ([]interface{}, error)
- func HMSet(key string, fields map[string]interface{}) error
- func HSet(key string, item string, value interface{}) error
- func HasKey(key string) (bool, error)
- func Incr(key string) (int64, error)
- func IncrBy(key string, delta int) (int64, error)
- func InitRedisClient(opts Options)
- func LPop(key string) (string, error)
- func LRemove(key string, count int, value interface{}) (int64, error)
- func RPush(key string, values ...interface{}) (int64, error)
- func SGet(key string) ([]string, error)
- func SIsMember(key string, value interface{}) (bool, error)
- func SRemove(key string, values ...interface{}) (int64, error)
- func Set(key string, value interface{}) error
- func SetExpire(key string, value interface{}, expire int) error
- func SetNX(key string, value interface{}) error
- func SetNXExpire(key string, value interface{}, expire int) error
- func SetStruct(key string, value interface{}) error
- func SetStructExpire(key string, value interface{}, expire int) error
- type Options
- type Pool
- type RedisLock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIndex ¶
GetIndex 通过索引 获取list中的值 key 键 index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
func SetNXExpire ¶
SetNXExpire 放入缓存并设置时间 key 键 value 值 expire 时间(秒) time要大于0 如果time小于等于0 将设置无限期
func SetStructExpire ¶
SetStructExpire 普通缓存放入 key value 转为json string expire 过期时间,秒
Types ¶
type Options ¶
type Options struct { // redis 连接模式,standalone、sentinel、cluster Mode string // 服务器地址 Host string // 服务器连接密码 Password string // 数据库索引(默认为0) Database int // 连接超时时间(毫秒) Timeout int // 连接池配置 Pool Pool }
func NewDefaultOptions ¶
func NewDefaultOptions() Options
Click to show internal directories.
Click to hide internal directories.