Documentation
¶
Index ¶
- type Locker
- func (l *Locker) Extend(ctx context.Context, vp *valkey.Pool, value string, expiration time.Duration) error
- func (l *Locker) Grab(ctx context.Context, vp *valkey.Pool, retry time.Duration) (string, error)
- func (l *Locker) IsLocked(ctx context.Context, vp *valkey.Pool) (bool, error)
- func (l *Locker) Release(ctx context.Context, vp *valkey.Pool, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Locker ¶
type Locker struct {
// contains filtered or unexported fields
}
Locker is a lock implementation where grabbing returns a lock value and that value must be used to release or extend the lock.
func (*Locker) Extend ¶
func (l *Locker) Extend(ctx context.Context, vp *valkey.Pool, value string, expiration time.Duration) error
Extend extends our lock expiration by the passed in number of seconds provided the lock value is correct
func (*Locker) Grab ¶
Grab tries to grab this lock in an atomic operation. It returns the lock value if successful. It will retry every second until the retry period has ended, returning empty string if not acquired in that time.
Click to show internal directories.
Click to hide internal directories.