redis

package
v0.0.0-...-42cc2d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2024 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetRedisInstance

func SetRedisInstance(dbName string, instance []RedisInstance)

Types

type RedisInstance

type RedisInstance struct {
	Client *redis.Client
}

func GetRedisInstance

func GetRedisInstance(dbName string) (*RedisInstance, error)

func (*RedisInstance) Decr

func (r *RedisInstance) Decr(ctx context.Context, key string) (int64, error)

func (*RedisInstance) DecrBy

func (r *RedisInstance) DecrBy(ctx context.Context, key string, decrAmount int64) (int64, error)

func (*RedisInstance) Del

func (r *RedisInstance) Del(ctx context.Context, key string) error

func (*RedisInstance) Expire

func (r *RedisInstance) Expire(ctx context.Context, key string, expire int) error

Expire 设置键过期时间,expire的单位为秒

func (*RedisInstance) Get

func (r *RedisInstance) Get(ctx context.Context, key string) (string, error)

func (*RedisInstance) GetString

func (r *RedisInstance) GetString(ctx context.Context, key string) (string, error)

func (*RedisInstance) Hdel

func (r *RedisInstance) Hdel(ctx context.Context, key, field string) (int64, error)

func (*RedisInstance) Hget

func (r *RedisInstance) Hget(ctx context.Context, key, field string) (string, error)

func (*RedisInstance) Hgetall

func (r *RedisInstance) Hgetall(ctx context.Context, key string) (map[string]string, error)

func (*RedisInstance) Hincrby

func (r *RedisInstance) Hincrby(ctx context.Context, key, field string, incrAmount int64) (int64, error)

func (*RedisInstance) Hkeys

func (r *RedisInstance) Hkeys(ctx context.Context, key string) ([]string, error)

func (*RedisInstance) Hlen

func (r *RedisInstance) Hlen(ctx context.Context, key string) (int64, error)

func (*RedisInstance) Hset

func (r *RedisInstance) Hset(ctx context.Context, key, field string, val interface{}) (int64, error)

func (*RedisInstance) Incr

func (r *RedisInstance) Incr(ctx context.Context, key string) (int64, error)

func (*RedisInstance) IncrBy

func (r *RedisInstance) IncrBy(ctx context.Context, key string, value int64) (int64, error)

func (*RedisInstance) Llen

func (r *RedisInstance) Llen(ctx context.Context, key string) (int64, error)

func (*RedisInstance) Lpop

func (r *RedisInstance) Lpop(ctx context.Context, key string) (string, error)

Lpop 用法:Lpop("key")

func (*RedisInstance) Lpush

func (r *RedisInstance) Lpush(ctx context.Context, key string, val interface{}) (int64, error)

Lpush 用法:Lpush("key", val)

func (*RedisInstance) Lrem

func (r *RedisInstance) Lrem(ctx context.Context, key string, val interface{}, count int64) (int64, error)

func (*RedisInstance) Pub

func (r *RedisInstance) Pub(ctx context.Context, channel string, msg string) (int64, error)

func (*RedisInstance) Rpop

func (r *RedisInstance) Rpop(ctx context.Context, key string) (string, error)

Rpop 用法:Rpop("key")

func (*RedisInstance) SAdd

func (r *RedisInstance) SAdd(ctx context.Context, key string, value string) (int64, error)

func (*RedisInstance) SMembers

func (r *RedisInstance) SMembers(ctx context.Context, key string) ([]string, error)

func (*RedisInstance) SRANDMEMBER

func (r *RedisInstance) SRANDMEMBER(ctx context.Context, key string) (string, error)

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)

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) SetString

func (r *RedisInstance) SetString(ctx context.Context, key string, value string) (string, error)

func (*RedisInstance) Sub

func (r *RedisInstance) Sub(ctx context.Context, consumeFunc func(data *redis.Message) error, channel string) error

func (*RedisInstance) Ttl

func (r *RedisInstance) Ttl(ctx context.Context, key string) (int64, error)

func (*RedisInstance) Zadd

func (r *RedisInstance) Zadd(ctx context.Context, key string, score float64, member interface{}) (int64, error)

func (*RedisInstance) Zrangebyscore

func (r *RedisInstance) Zrangebyscore(ctx context.Context, key, min, max string) ([]string, error)

func (*RedisInstance) Zrevrange

func (r *RedisInstance) Zrevrange(ctx context.Context, key string, start, stop int64) ([]string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL