Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrLockFailed 锁已被占用 ErrLockFailed = errors.New("failed to acquire lock") // ErrUnlockFailed 释放锁失败 ErrUnlockFailed = errors.New("failed to release lock") )
Functions ¶
This section is empty.
Types ¶
type Etcd ¶
type Etcd struct {
// contains filtered or unexported fields
}
type EtcdOption ¶
type EtcdOption func(*Etcd)
func WithEtcdKey ¶
func WithEtcdKey(key string) EtcdOption
func WithEtcdTTL ¶
func WithEtcdTTL(ttl int64) EtcdOption
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func NewRedis ¶
func NewRedis(client *redis.Client, opts ...RedisOption) *Redis
func (*Redis) LockContext ¶
LockContext 基于redis实现分布式锁 获取锁失败会一直阻塞,直到获取到锁或获取锁超时
type RedisOption ¶
type RedisOption func(*Redis)
func WithRedisDelayFunc ¶
func WithRedisDelayFunc(f func() time.Duration) RedisOption
func WithRedisExpire ¶
func WithRedisExpire(expire time.Duration) RedisOption
func WithRedisKey ¶
func WithRedisKey(key string) RedisOption
func WithRedisTries ¶
func WithRedisTries(tries int) RedisOption
func WithRedisValue ¶
func WithRedisValue(value string) RedisOption
Click to show internal directories.
Click to hide internal directories.