redis

package
v2.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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
}

func NewLocker

func NewLocker(redis redis.UniversalClient, name string, timeout time.Duration, opts ...Option) *Locker

func (*Locker) ForceRelease

func (l *Locker) ForceRelease(ctx context.Context) error

func (*Locker) LockedOwner

func (l *Locker) LockedOwner(ctx context.Context) (string, error)

func (*Locker) Owner

func (l *Locker) Owner() string

func (*Locker) Release

func (l *Locker) Release(ctx context.Context) (bool, error)

func (*Locker) Try

func (l *Locker) Try(ctx context.Context, fn func() error) error

func (*Locker) Until

func (l *Locker) Until(ctx context.Context, timeout time.Duration, fn func() error) error

type Option

type Option func(*Locker)

func WithOwner

func WithOwner(owner string) Option

func WithSeconds deprecated

func WithSeconds(timeout time.Duration) Option

Deprecated: Use WithTimeout instead.

func WithSleep

func WithSleep(sleep time.Duration) Option

func WithTimeout added in v2.17.0

func WithTimeout(timeout time.Duration) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL