Documentation ¶
Index ¶
- func GetAndJsonUnmarshal(r *Redis, key string, obj interface{}) error
- func SetExAndJsonMarshalHelper(r *Redis, key string, expire int32, obj interface{}) error
- type Option
- type Redis
- func (r *Redis) Del(key string) error
- func (r *Redis) Do(commandName string, args ...interface{}) (reply interface{}, err error)
- func (r *Redis) DoInExpiredAt(f func() error, key string, expiredAt int) error
- func (r *Redis) DoWithLock(f func() error, key string) error
- func (r *Redis) IncUtilToNight(key string, v int) (int, error)
- func (r *Redis) IncWithInitialTime(key string, expired int, v int) (int, error)
- func (r *Redis) TryLock(key string, expired int) bool
- type RedisConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAndJsonUnmarshal ¶
反序列化
Types ¶
type Option ¶
type Option func(*options)
func WithIdleTimeout ¶
func WithMaxActive ¶
func WithMaxIdle ¶
type Redis ¶
func NewRedis ¶
func NewRedis(conf RedisConfig, options ...Option) *Redis
func NewRedisByPool ¶
func (*Redis) DoInExpiredAt ¶
f()函数操作 防止并发上锁和限制频率,expiredAt秒内操作一次
func (*Redis) DoWithLock ¶
f()函数操作 防止并发上锁,默认30秒
func (*Redis) IncWithInitialTime ¶
设置目标key增加v,并且当key不存在的时候生存时间为t秒,返回增加后的值
type RedisConfig ¶
type RedisConfig struct { Address string `json:"addr"` Password string `json:"password"` DBNum int `json:"db"` }
RedisConfig RedisConfig
Click to show internal directories.
Click to hide internal directories.