Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RedisConfig ¶
type RedisConfig struct { Addr string `json:"addr"` Password string `json:"password"` DB int `json:"DB"` DialTimeout int64 `json:"dialTimeout"` ReadTimeout int64 `json:"readTimeout"` WriteTimeout int64 `json:"writeTimeout"` IdleTimeout int64 `json:"idleTimeout"` // 连接生效时间,默认5分钟 MaxRetries int `json:"maxRetries"` PoolSize int `json:"poolSize"` MinIdleConn int `json:"minIdleConn"` }
type RedisCounter ¶
type RedisCounter struct {
// contains filtered or unexported fields
}
RedisCounter Redis 计数器
func NewRedisCounter ¶
func NewRedisCounter(client *redis.Client, key string, keyFmtArgs ...interface{}) *RedisCounter
func (*RedisCounter) Incr ¶
func (c *RedisCounter) Incr() int64
type RedisLocker ¶
type RedisLocker struct {
// contains filtered or unexported fields
}
RedisLocker Redis 锁
func NewRedisLocker ¶
func NewRedisLocker(client *redis.Client, key string, keyFmtArgs ...interface{}) *RedisLocker
func (*RedisLocker) Key ¶
func (l *RedisLocker) Key() string
func (*RedisLocker) Lock ¶
func (l *RedisLocker) Lock(values ...interface{}) bool
func (*RedisLocker) Unlock ¶
func (l *RedisLocker) Unlock(values ...interface{}) bool
func (*RedisLocker) WithConfig ¶
func (l *RedisLocker) WithConfig(retries int, interval, expiration time.Duration) *RedisLocker
Click to show internal directories.
Click to hide internal directories.