Documentation
¶
Index ¶
- Variables
- func AddKeyValue(key, value string) error
- func AddKeyValueWithExpiration(key string, value interface{}, expiration time.Duration) error
- func AddMultipleToSet(key string, members ...interface{}) error
- func AddMultipleToSetWithExpiration(key string, expiration time.Duration, members ...interface{}) error
- func AddToSet(key string, member interface{}) error
- func AddToSetWithExpiration(key string, member interface{}, expiration time.Duration) error
- func Client() *redis.Client
- func Close() error
- func GetKeyValue(key string, value interface{}) error
- func GetSetMembers(key string) ([]string, error)
- func Init() error
- func IsMemberOfSet(key string, member interface{}) (bool, error)
- func NewClient() (*redis.Client, error)
- func RemoveAllFromSet(key string) error
- func RemoveFromSet(key string, member interface{}) error
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = Options{
Address: "localhost:6379",
Timeout: &defaultTimeout,
}
View Source
var NilErr = errors.New("nil")
NilErr represents redis nil
Functions ¶
func AddKeyValue ¶
setKeyValueWithoutExpiration 添加键值对到Redis(不携带过期时间)
func AddKeyValueWithExpiration ¶
setStructWithExpiration 添加带有过期时间的结构体到键
func AddMultipleToSet ¶
addMultipleToSet 批量添加元素到集合
func AddMultipleToSetWithExpiration ¶
func AddMultipleToSetWithExpiration(key string, expiration time.Duration, members ...interface{}) error
addToSetWithExpiration 批量添加元素到集合并设置过期时间
func AddToSetWithExpiration ¶
addToSetWithExpiration 向集合中添加元素并设置过期时间
func IsMemberOfSet ¶
isMemberOfSet 检查元素是否属于集合
func RemoveFromSet ¶
removeFromSet 从集合中删除元素
Types ¶
type Options ¶
type Options struct { // Address of the Redis server, including the port. // Optional ("localhost:6379" by default). Address string // Password for the Redis server. // Optional ("" by default). Password string // DB to use. // Optional (0 by default). DB int // The timeout for operations. // Optional (2 * time.Second by default). Timeout *time.Duration }
Options are the options for the Redis client.
func GetRedisOptions ¶
func GetRedisOptions() Options
Click to show internal directories.
Click to hide internal directories.