Versions in this module Expand all Collapse all v7 v7.0.0 Nov 13, 2017 Changes in this version + var ErrLockNotObtained = errors.New("lock not obtained") + func Run(client RedisClient, key string, opts *Options, handler func() error) error + type Locker struct + func New(client RedisClient, key string, opts *Options) *Locker + func Obtain(client RedisClient, key string, opts *Options) (*Locker, error) + func (l *Locker) IsLocked() bool + func (l *Locker) Lock() (bool, error) + func (l *Locker) LockWithContext(ctx context.Context) (bool, error) + func (l *Locker) Unlock() error + type Options struct + LockTimeout time.Duration + RetryCount int + RetryDelay time.Duration + type RedisClient interface + Eval func(script string, keys []string, args ...interface{}) *redis.Cmd + EvalSha func(sha1 string, keys []string, args ...interface{}) *redis.Cmd + ScriptExists func(scripts ...string) *redis.BoolSliceCmd + ScriptLoad func(script string) *redis.StringCmd + SetNX func(key string, value interface{}, expiration time.Duration) *redis.BoolCmd Other modules containing this package gopkg.in/bsm/redis-lock.v3 gopkg.in/bsm/redis-lock.v4 gopkg.in/bsm/redis-lock.v6 gopkg.in/bsm/redis-lock.v8