Documentation ¶
Index ¶
- Constants
- Variables
- func Delete(keys ...string) error
- func Eval(script string, keys []string, args ...interface{}) error
- func ExistKey(key string) bool
- func ExpireTime(key string, t time.Duration) error
- func Get(key string) (string, error)
- func GetExpire(key string) (time.Duration, error)
- func HDel(key string, fields ...string) (int64, error)
- func HExists(key, field string) (bool, error)
- func HGet(key, field string) (string, error)
- func HGetAll(key string) (map[string]string, error)
- func HKeys(key string) ([]string, error)
- func HLen(key string) (int64, error)
- func HSet(key, field string, value any) error
- func HSetMap(key string, fields map[string]any) error
- func HSetMapExpire(key string, fields map[string]any, expireTime time.Duration) error
- func HVals(key string) ([]string, error)
- func LIndex(key string, index int64) (string, error)
- func LPop(key string) (string, error)
- func LPush(key string, values ...interface{}) error
- func LRange(key string, start, stop int64) ([]string, error)
- func New(rds *Redis) (*redis.Client, error)
- func Publish(channel, message string)
- func RPop(key string) (string, error)
- func RPush(key string, values ...interface{}) error
- func RemoveExpire(key string) error
- func Rename(oldKey, newKey string) (bool, error)
- func SAdd(key string, members ...interface{}) error
- func SIsMember(key string, member interface{}) (bool, error)
- func SMembers(key string) ([]string, error)
- func SRem(key string, members ...interface{}) error
- func Set(key string, value interface{}) error
- func SetExpire(key string, value interface{}, expireTime time.Duration) error
- func Subscribe(channel string, cb func(string)) *redis.PubSub
- func ZAdd(key string, members ...*redis.Z) error
- func ZRange(key string, start, stop int64) ([]string, error)
- func ZRank(key string, member string) (int64, error)
- func ZRem(key string, members ...interface{}) error
- type Redis
Constants ¶
View Source
const APP = "redis"
Variables ¶
View Source
var Cli *redis.Client
Functions ¶
func HSetMapExpire ¶
HSetMapExpire 设置map对象位hash表
Types ¶
type Redis ¶
type Redis struct { Addr string `mapstructure:"addr" default:"" yaml:"addr" json:"addr"` // Redis 服务器的地址 Password string `mapstructure:"password" default:"" yaml:"password" json:"password"` // Redis 服务器的密码 DB int `mapstructure:"db" default:"" yaml:"db" json:"db"` // Redis 服务器的数据库编号 MaxRetries int `mapstructure:"max-retries" default:"3" yaml:"max-retries" json:"max-retries"` // Redis 客户端重试连接的最大次数 DialTimeout time.Duration `mapstructure:"dial-timeout" default:"5" yaml:"dial-timeout" json:"dial-timeout"` // 连接 Redis 服务器的超时时间 ReadTimeout time.Duration `mapstructure:"read-timeout" default:"3" yaml:"read-timeout" json:"read-timeout"` // 从 Redis 服务器读取数据的超时时间 WriteTimeout time.Duration `mapstructure:"write-timeout" default:"3" yaml:"write-timeout" json:"write-timeout"` // 向 Redis 服务器写入数据的超时时间 PoolSize int `mapstructure:"pool-size" default:"10" yaml:"pool-size" json:"pool-size" ` // 连接池的最大连接数 MinIdleConns int `mapstructure:"min-idle-conns" default:"0" yaml:"min-idle-conns" json:"min-idle-conns"` // 连接池的最小空闲连接数 MaxConnAge time.Duration `mapstructure:"max-conn-age" default:"0" yaml:"max-conn-age" json:"max-conn-age"` // 连接池中连接的最大寿命,超过这个时间将被关闭 PoolTimeout time.Duration `mapstructure:"pool-timeout" default:"4" yaml:"pool-timeout" json:"pool-timeout"` // 从连接池获取连接的超时时间 IdleTimeout time.Duration `mapstructure:"idle-timeout" default:"5" yaml:"idle-timeout" json:"idle-timeout"` // 连接池中空闲连接的超时时间 IdleCheckFrequency time.Duration `mapstructure:"idle-check-frequency" default:"1" yaml:"idle-check-frequency" json:"idle-check-frequency"` // 连接池中空闲连接的检查频率 }
Click to show internal directories.
Click to hide internal directories.