Versions in this module Expand all Collapse all v1 v1.1.0 Nov 7, 2026 v1.0.0 Nov 7, 2026 Changes in this version + var ErrNotAcquired = errors.New("lock: already held") + var ErrNotHeld = errors.New("lock: no longer held") + func Do(ctx context.Context, l Locker, key string, ttl time.Duration, ...) (ran bool, err error) + type Lock struct + Key string + Token string + func (l *Lock) Refresh(ctx context.Context, ttl time.Duration) error + func (l *Lock) Release(ctx context.Context) error + type Locker interface + Acquire func(ctx context.Context, key string, ttl time.Duration) (*Lock, error) + type Memory struct + func NewMemory() *Memory + func (m *Memory) Acquire(_ context.Context, key string, ttl time.Duration) (*Lock, error) + type Noop struct + func (Noop) Acquire(context.Context, string, time.Duration) (*Lock, error) + type RedisLocker struct + func NewRedis(client redis.UniversalClient, prefix string) *RedisLocker + func (r *RedisLocker) Acquire(ctx context.Context, key string, ttl time.Duration) (*Lock, error)