Documentation ¶
Overview ¶
reids
Index ¶
- func SetRedisInstance(dbName string, instance []RedisInstance)
- type RedisInstance
- func (r *RedisInstance) Decr(ctx context.Context, key string) (int64, error)
- func (r *RedisInstance) DecrBy(ctx context.Context, key string, decrAmount int64) (int64, error)
- func (r *RedisInstance) Del(ctx context.Context, key string) error
- func (r *RedisInstance) Expire(ctx context.Context, key string, expire int) error
- func (r *RedisInstance) Get(ctx context.Context, key string) (string, error)
- func (r *RedisInstance) GetString(ctx context.Context, key string) (string, error)
- func (r *RedisInstance) Hdel(ctx context.Context, key, field string) (int64, error)
- func (r *RedisInstance) Hget(ctx context.Context, key, field string) (string, error)
- func (r *RedisInstance) Hgetall(ctx context.Context, key string) (map[string]string, error)
- func (r *RedisInstance) Hincrby(ctx context.Context, key, field string, incrAmount int64) (int64, error)
- func (r *RedisInstance) Hkeys(ctx context.Context, key string) ([]string, error)
- func (r *RedisInstance) Hset(ctx context.Context, key, field string, val interface{}) (int64, error)
- func (r *RedisInstance) Incr(ctx context.Context, key string) (int64, error)
- func (r *RedisInstance) IncrBy(ctx context.Context, key string, value int64) (int64, error)
- func (r *RedisInstance) Llen(ctx context.Context, key string) (int64, error)
- func (r *RedisInstance) Lpop(ctx context.Context, key string) (string, error)
- func (r *RedisInstance) Lpush(ctx context.Context, key string, val interface{}) (int64, error)
- func (r *RedisInstance) Lrem(ctx context.Context, key string, val interface{}, count int64) (int64, error)
- func (r *RedisInstance) Pub(ctx context.Context, channel string, msg string) (int64, error)
- func (r *RedisInstance) Rpop(ctx context.Context, key string) (string, error)
- func (r *RedisInstance) SAdd(ctx context.Context, key string, value string) (int64, error)
- func (r *RedisInstance) SMembers(ctx context.Context, key string) ([]string, error)
- func (r *RedisInstance) SRANDMEMBER(ctx context.Context, key string) (string, error)
- func (r *RedisInstance) Set(ctx context.Context, key string, val interface{}, expire int) (string, error)
- func (r *RedisInstance) SetNx(ctx context.Context, key string, val interface{}, expire int) (bool, error)
- func (r *RedisInstance) SetNxEx(ctx context.Context, key string, val interface{}, expire int) (string, error)
- func (r *RedisInstance) SetString(ctx context.Context, key string, value string) (string, error)
- func (r *RedisInstance) Sub(ctx context.Context, consumeFunc func(data *redis.Message) error, ...) error
- func (r *RedisInstance) Ttl(ctx context.Context, key string) (int64, error)
- func (r *RedisInstance) Zadd(ctx context.Context, key string, score float64, member interface{}) (int64, error)
- func (r *RedisInstance) Zrangebyscore(ctx context.Context, key, min, max string) ([]string, error)
- func (r *RedisInstance) Zrevrange(ctx context.Context, key string, start, stop int64) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetRedisInstance ¶
func SetRedisInstance(dbName string, instance []RedisInstance)
SetRedisInstance 设置实例
Types ¶
type RedisInstance ¶
type RedisInstance struct {
Client *redis.Client
}
RedisInstance reids客户端对象
func GetRedisInstance ¶
func GetRedisInstance(dbName string) (*RedisInstance, error)
GetRedisInstance 获取redis实例
func (*RedisInstance) Del ¶
func (r *RedisInstance) Del(ctx context.Context, key string) error
Del 删除
func (*RedisInstance) Hincrby ¶
func (r *RedisInstance) Hincrby(ctx context.Context, key, field string, incrAmount int64) (int64, error)
Hincrby 为哈希表 key 中的指定字段的整数值加上增量 increment
func (*RedisInstance) Hset ¶
func (r *RedisInstance) Hset(ctx context.Context, key, field string, val interface{}) (int64, error)
Hset 设置hash值
func (*RedisInstance) Lrem ¶
func (r *RedisInstance) Lrem(ctx context.Context, key string, val interface{}, count int64) (int64, error)
Lrem 移除列表中与参数 VALUE 相等的元素
func (*RedisInstance) SRANDMEMBER ¶
SRANDMEMBER 返回集合中一个或多个随机数
func (*RedisInstance) Set ¶
func (r *RedisInstance) Set(ctx context.Context, key string, val interface{}, expire int) (string, error)
Set 设置值:Set("key", val, 60),其中 expire 的单位为秒
func (*RedisInstance) SetNx ¶
func (r *RedisInstance) SetNx(ctx context.Context, key string, val interface{}, expire int) (bool, error)
SetNx SetNx("key", val, 60),其中 expire 的单位为秒
func (*RedisInstance) SetNxEx ¶
func (r *RedisInstance) SetNxEx(ctx context.Context, key string, val interface{}, expire int) (string, error)
SetNxEx exist set value + expires otherwise not do cmd: set key value ex 3600 nx
func (*RedisInstance) Sub ¶
func (r *RedisInstance) Sub(ctx context.Context, consumeFunc func(data *redis.Message) error, channel string) error
Sub 订阅
func (*RedisInstance) Zadd ¶
func (r *RedisInstance) Zadd(ctx context.Context, key string, score float64, member interface{}) (int64, error)
Zadd 添加有序集合操作
func (*RedisInstance) Zrangebyscore ¶
Zrangebyscore 获取有序集合
Click to show internal directories.
Click to hide internal directories.