Documentation
¶
Index ¶
- Variables
- type Config
- type RedisClient
- func (r *RedisClient) Del(keys ...string) error
- func (r *RedisClient) Exists(key string) (bool, error)
- func (r *RedisClient) Get(key string) (string, error)
- func (r *RedisClient) GetMap(key string) (map[string]interface{}, error)
- func (r *RedisClient) GetMaps(key string) ([]map[string]interface{}, error)
- func (r *RedisClient) HDel(key string, fields ...string) error
- func (r *RedisClient) HGet(key, field string) (string, error)
- func (r *RedisClient) HSet(key string, values ...interface{}) error
- func (r *RedisClient) HSetWithExpire(key string, ttl time.Duration, values ...interface{}) error
- func (r *RedisClient) Keys(pattern string) ([]string, error)
- func (r *RedisClient) LIndex(key string, index int64) (string, error)
- func (r *RedisClient) LLen(key string) (int64, error)
- func (r *RedisClient) LPop(key string) (string, error)
- func (r *RedisClient) LPush(key string, values ...interface{}) error
- func (r *RedisClient) LRange(key string, start, stop int64) ([]string, error)
- func (r *RedisClient) RPop(key string) (string, error)
- func (r *RedisClient) RPush(key string, values ...interface{}) error
- func (r *RedisClient) RPushWithExpire(key string, ttl time.Duration, values ...interface{}) error
- func (r *RedisClient) Set(key string, value interface{}, expiration time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
RC = RedisClient{} // 全局 Redis 客户端实例
)
Functions ¶
This section is empty.
Types ¶
type RedisClient ¶
type RedisClient struct {
// contains filtered or unexported fields
}
func (*RedisClient) GetMap ¶
func (r *RedisClient) GetMap(key string) (map[string]interface{}, error)
Get 获取MAP值
func (*RedisClient) GetMaps ¶
func (r *RedisClient) GetMaps(key string) ([]map[string]interface{}, error)
Get 获取MAP数组值
func (*RedisClient) HDel ¶
func (r *RedisClient) HDel(key string, fields ...string) error
HDel 删除哈希字段
func (*RedisClient) HGet ¶
func (r *RedisClient) HGet(key, field string) (string, error)
HGet 获取哈希字段
func (*RedisClient) HSet ¶
func (r *RedisClient) HSet(key string, values ...interface{}) error
HSet 设置哈希字段
func (*RedisClient) HSetWithExpire ¶ added in v0.0.5
func (r *RedisClient) HSetWithExpire(key string, ttl time.Duration, values ...interface{}) error
func (*RedisClient) Keys ¶
func (r *RedisClient) Keys(pattern string) ([]string, error)
Keys 获取匹配的 key 列表(仅支持单节点)
func (*RedisClient) LIndex ¶ added in v0.0.5
func (r *RedisClient) LIndex(key string, index int64) (string, error)
获取指定下标的数据
func (*RedisClient) LLen ¶ added in v0.0.5
func (r *RedisClient) LLen(key string) (int64, error)
查询 List 长度
func (*RedisClient) LPop ¶ added in v0.0.5
func (r *RedisClient) LPop(key string) (string, error)
弹出数据(从左边)
func (*RedisClient) LPush ¶ added in v0.0.5
func (r *RedisClient) LPush(key string, values ...interface{}) error
插入数据(左插入,最新数据在最前)
func (*RedisClient) LRange ¶ added in v0.0.5
func (r *RedisClient) LRange(key string, start, stop int64) ([]string, error)
获取指定区间的数据 start=0, stop=-1 表示获取全部
func (*RedisClient) RPop ¶ added in v0.0.5
func (r *RedisClient) RPop(key string) (string, error)
弹出数据(从右边)
func (*RedisClient) RPush ¶ added in v0.0.5
func (r *RedisClient) RPush(key string, values ...interface{}) error
插入数据(右插入,最新数据在最后)
func (*RedisClient) RPushWithExpire ¶ added in v0.0.5
func (r *RedisClient) RPushWithExpire(key string, ttl time.Duration, values ...interface{}) error
插入并设置过期时间
Click to show internal directories.
Click to hide internal directories.