Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶ added in v1.20.6
type Client struct { *redis.Client // contains filtered or unexported fields }
func NewClient ¶
func NewClient(config *RedisConfig) (client *Client, err error)
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"` KeyPrefix string `json:"keyPrefix"` }
type RedisCounter ¶
type RedisCounter struct {
// contains filtered or unexported fields
}
RedisCounter Redis 计数器
func NewRedisCounter ¶
func NewRedisCounter(client *Client, key string, keyFmtArgs ...interface{}) *RedisCounter
type RedisLocker ¶
type RedisLocker struct {
// contains filtered or unexported fields
}
RedisLocker Redis 锁
func NewRedisLocker ¶
func NewRedisLocker(client *Client, key string, keyFmtArgs ...interface{}) *RedisLocker
func (*RedisLocker) Key ¶
func (l *RedisLocker) Key() string
func (*RedisLocker) Lock ¶
func (l *RedisLocker) Lock(ctx context.Context, values ...interface{}) bool
func (*RedisLocker) Unlock ¶
func (l *RedisLocker) Unlock(ctx context.Context, 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.