Documentation ¶
Index ¶
- Variables
- func LeaseLock(lock locker.Locker, key string, expire int, ops ...options.Option) (func() error, error)
- func NewRedisLock(client redis.UniversalClient, opts ...options.Option) locker.Locker
- func SetInterval(duration time.Duration) options.Option
- func SetLeaseEnable(enable bool) options.Option
- func SetLeaseInterval(duration time.Duration) options.Option
- func SetLeaseLogger(logger log.Logger) options.Option
- func SetLeaseRandomNum(randomNum int) options.Option
- func SetRetries(retries int) options.Option
- type Lock
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLockFailed = errors.New("获取锁失败") ErrUnLockFailed = errors.New("释放锁失败") CMDLock = `` /* 193-byte string literal not displayed */ CMDUnlock = `if redis.call("GET", KEYS[1]) == ARGV[1] then return redis.call("DEL", KEYS[1]) else return 0 end` )
Functions ¶
func NewRedisLock ¶
func SetLeaseEnable ¶
func SetLeaseRandomNum ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.