redis

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScriptLock = `` /* 203-byte string literal not displayed */

	ScriptExpire = `` /* 217-byte string literal not displayed */

	ScriptDecrby = `` /* 232-byte string literal not displayed */

	ScriptIncrby = `` /* 218-byte string literal not displayed */

	ScriptDelete = `` /* 200-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func CloseRedisPool

func CloseRedisPool()

CloseRedisPool 关闭 所有redis pool

func DecrbyKey

func DecrbyKey(ctx context.Context, name, key string, number int64) (num int64, err error)

DecrbyKey **** 设置key减少指定的数值 name:redis名称 key:查询的key number:数值 返回 num error *****//

func DeleteKey added in v0.0.19

func DeleteKey(ctx context.Context, name string, key string) error

DeleteKey **** 删除key name:redis名称 key:删除key 返回 error *****//

func DeleteRedisLockKey

func DeleteRedisLockKey(ctx context.Context, key, lockName string, name ...string) (bool, error)

DeleteRedisLockKey **** 删除分布式锁 name:redis名称 key:删除key lockName: 锁名字 返回 int *****//

func ExistsKey

func ExistsKey(ctx context.Context, name, key string) (bool, error)

ExistsKey **** 是否存在 name:redis名称 key:查询的key 返回 bool error *****//

func ExpireKey

func ExpireKey(ctx context.Context, name, key string, expire int64) error

ExpireKey **** 设置key过期时间 name:redis名称 key:查询的key 返回 error *****//

func GetBitmapKey

func GetBitmapKey(ctx context.Context, name, key string, offset int) (int, error)

GetBitmapKey **** 获取bitmap name:redis名称 key:删除key offset:偏移量 返回 int error *****//

func GetKey added in v0.0.38

func GetKey(ctx context.Context, name, key string) (interface{}, error)

GetKey **** 获取name:redis名称 key:查询的key 返回 interface{} *****//

func GetRedisConnect

func GetRedisConnect(ctx context.Context, redisConfig gin_config.RedisConf) (redis.Conn, error)

func HDelMapKey added in v0.0.38

func HDelMapKey(ctx context.Context, name, mapKey, key string) (err error)

HDelMapKey 获取map值

func HGetMapKey added in v0.0.38

func HGetMapKey(ctx context.Context, name, mapKey, key string) (value string, err error)

HGetMapKey 获取map值

func HMGetMapKey added in v0.0.38

func HMGetMapKey(ctx context.Context, name, mapKey string, args []interface{}) (data []string, err error)

HMGetMapKey 设置map值

func HMSetMapKey added in v0.0.38

func HMSetMapKey(ctx context.Context, name, mapKey string, args []interface{}) (err error)

HMSetMapKey 设置map值

func HSetMapKey added in v0.0.38

func HSetMapKey(ctx context.Context, name, mapKey, key, value string) (err error)

HSetMapKey 设置map值

func IncrbyKey

func IncrbyKey(ctx context.Context, name, key string, number int64) (num int64, err error)

IncrbyKey **** 设置key增加指定的数值 name:redis名称 key:查询的key number:数值 返回 num error *****//

func InitRedis

func InitRedis()

func MGetKey added in v0.0.38

func MGetKey(ctx context.Context, name string, keys []string) (interface{}, error)

MGetKey **** 获取name:redis名称 keys:查询的key 返回 interface{} *****//

func MSetKey added in v0.0.39

func MSetKey(ctx context.Context, name string, keys []string) error

MSetKey **** 设置name:redis名称 keys:设置的key value 返回 error *****//

func ResetExpireRedisLockKey

func ResetExpireRedisLockKey(ctx context.Context, key, lockName string, time int, name ...string) (bool, error)

ResetExpireRedisLockKey **** 续费分布式锁 name:redis名称 key:删除key lockName: 锁名字 返回 int *****//

func ScriptDecrbyKey added in v0.0.37

func ScriptDecrbyKey(ctx context.Context, key string, number int, name ...string) (bool, error)

ScriptDecrbyKey **** redis 脚本减少库存 *****//

func ScriptIncrbyKey added in v0.0.37

func ScriptIncrbyKey(ctx context.Context, key string, number int, name ...string) (bool, error)

ScriptIncrbyKey **** redis 脚本增加库存 *****//

func SendScrip added in v0.0.37

func SendScrip(ctx context.Context, scriptString string, keyCount int, name ...string) (string, error)

SendScrip **** redis 上传脚本 不执行 *****//

func SetBitmapKey

func SetBitmapKey(ctx context.Context, name, key string, offset, value int) error

SetBitmapKey **** 设置bitmap name:redis名称 key:删除key offset:偏移量 value:只能0,1 返回 error *****//

func SetKeyValue

func SetKeyValue(ctx context.Context, name, key string, value interface{}, expire ...int) (err error)

SetKeyValue **** 设置name:redis名称 key:查询的key value:设定的值 expire:存在时间 返回 error *****//

func SetRedisLockKey

func SetRedisLockKey(ctx context.Context, key, lockName string, time int, name ...string) (bool, error)

SetRedisLockKey **** 设置分布式锁 name:redis名称 key:值 lockName: 锁名字 time: 锁存在时间 返回 error *****//

func TtlKey

func TtlKey(ctx context.Context, name, key string) (int64, error)

TtlKey **** 返回 key 的剩余过期时间 name:redis名称 key:查询的key 返回 int64 error *****//

func UseRedis

func UseRedis(name ...string) *redis.Pool

UseRedis 获取使用的redis

Types

This section is empty.

Jump to

Keyboard shortcuts

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