mredis

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RedisClient *redis.Client

RedisClient 连接池

Functions

func DeleteKeys

func DeleteKeys(keys ...string) error

func ExistKeys

func ExistKeys(keys ...string) (bool, error)

key 是否存在

func ExistKeysRes added in v0.7.8

func ExistKeysRes(keys ...string) (int64, bool, error)

key 是否存在

func ExistSetMember

func ExistSetMember(key string, member interface{}) (bool, error)

判断是否存在集合中

func ExpireAtKey

func ExpireAtKey(key string, tm time.Time) error

以 UNIX 时间戳(unix timestamp)格式设置 key 的过期时间。

func ExpireKey

func ExpireKey(key string, expiration time.Duration) error

设置 key 的过期时间,key 过期后将不再可用.单位以秒计.

func GetSets

func GetSets(key string) ([]string, error)

获取集合所有值

func GetString

func GetString(key string) (string, error)

获取指定 key 的值。如果 key 不存在,返回 nil 。如果key 储存的值不是字符串类型,返回一个错误。

func LimitRate added in v0.6.4

func LimitRate(key string, expTime time.Duration) bool

通过 redis 限速, 防止连击

func RemoveSetMembers added in v0.7.7

func RemoveSetMembers(key string, members ...interface{}) error

移除集合中的一个或多个成员元素,不存在的成员元素会被忽略。

func SetKeyValue

func SetKeyValue(key string, data interface{}, expTime time.Duration) error

设置给定 key 的值。如果 key 已经存储其他值, SET 就覆写旧值,且无视类型。

func SetSet

func SetSet(key string, members ...interface{}) error

将一个或多个成员元素加入到集合中,已经存在于集合的成员元素将被忽略

func SetSetExpire

func SetSetExpire(key string, expiration time.Duration, members ...interface{}) error

带有过期时间的 Set

func Setup

func Setup(host, password string) error

Setup 初始化连接池

func TtlKey

func TtlKey(key string) (time.Duration, error)

以秒为单位返回 key 的剩余过期时间。 当 key 不存在时,返回 -2000000000 。 当 key 存在但没有设置剩余生存时间时,返回 -1000000000 。 否则,以秒为单位,返回 key 的剩余生存时间。

Types

This section is empty.

Jump to

Keyboard shortcuts

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