Versions in this module Expand all Collapse all v1 v1.0.1 Mar 23, 2025 Changes in this version + var ErrEmptyExpire = errors.New("empty expire") + var ErrExtendFailed = errors.New("redsync: failed to extend lock") + var ErrFailed = errors.New("redsync: failed to acquire lock") + var ErrLockAlreadyExpired = errors.New("redsync: failed to unlock, lock was already expired") + var ErrNothingToLock = errors.New("nothing to lock") + type DelayFunc func(tries int) time.Duration + type ErrNodeTaken struct + Node int + func (err ErrNodeTaken) Error() string + type ErrTaken struct + Nodes []int + func (err ErrTaken) Error() string + type Mutex struct + func (m *Mutex) Extend() (bool, error) + func (m *Mutex) ExtendContext(ctx context.Context) (bool, error) + func (m *Mutex) Lock() error + func (m *Mutex) LockContext(ctx context.Context) error + func (m *Mutex) MultipleLockContext(ctx context.Context) error + func (m *Mutex) Name() string + func (m *Mutex) TryLock() error + func (m *Mutex) TryLockContext(ctx context.Context) error + func (m *Mutex) Unlock() (bool, error) + func (m *Mutex) UnlockContext(ctx context.Context) (bool, error) + func (m *Mutex) UnlockMultipleContext(ctx context.Context) (bool, error) + func (m *Mutex) Until() time.Time + func (m *Mutex) Valid() (bool, error) + func (m *Mutex) ValidContext(ctx context.Context) (bool, error) + func (m *Mutex) Value() string + type Option interface + Apply func(*Mutex) + func WithDriftFactor(factor float64) Option + func WithExpiry(expiry time.Duration) Option + func WithFailFast(b bool) Option + func WithGenValueFunc(genValueFunc func() (string, error)) Option + func WithKeys(keys []string) Option + func WithRetryDelay(delay time.Duration) Option + func WithRetryDelayFunc(delayFunc DelayFunc) Option + func WithSetNXOnExtend() Option + func WithShufflePools(b bool) Option + func WithTimeoutFactor(factor float64) Option + func WithTries(tries int) Option + func WithValue(v string) Option + type OptionFunc func(*Mutex) + func (f OptionFunc) Apply(mutex *Mutex) + type RedisError struct + Err error + Node int + func (e RedisError) Error() string + func (e RedisError) Unwrap() error + type Redsync struct + func New(pools ...redis.Pool) *Redsync + func (r *Redsync) NewMutex(name string, options ...Option) *Mutex