mutex

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MutexPrefix = "mutex/"
View Source
var NonBlockingMutexPrefix = "non-blocking-mutex/"

Functions

This section is empty.

Types

type Locker

type Locker interface {
	Lock() error
	Unlock() error
}

type Mutex

type Mutex struct {
	QueueKey string
	// contains filtered or unexported fields
}

func NewMutex

func NewMutex(ctx context.Context, client *redis.Client, keySuffix string) *Mutex

func (*Mutex) Lock

func (m *Mutex) Lock() (rerr error)

func (*Mutex) Unlock

func (m *Mutex) Unlock() error

func (*Mutex) WithLockTimeout

func (m *Mutex) WithLockTimeout(d time.Duration) *Mutex

func (*Mutex) WithWaitTimeout

func (m *Mutex) WithWaitTimeout(d time.Duration) *Mutex

type NonBlockingLocker

type NonBlockingLocker interface {
	TryLock() (bool, error)
	Unlock() error
}

type NonBlockingMutex

type NonBlockingMutex struct {
	Key string
	// contains filtered or unexported fields
}

func NewNonBlockingMutex

func NewNonBlockingMutex(ctx context.Context, client *redis.Client, keySuffix string) *NonBlockingMutex

func (*NonBlockingMutex) TryLock

func (m *NonBlockingMutex) TryLock() (bool, error)

func (*NonBlockingMutex) Unlock

func (m *NonBlockingMutex) Unlock() error

func (*NonBlockingMutex) WithLockTimeout

func (m *NonBlockingMutex) WithLockTimeout(d time.Duration) *NonBlockingMutex

Jump to

Keyboard shortcuts

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