lock

package
v0.0.0-...-c6e4f4a Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedisLocker

func NewRedisLocker(client redis.Cmdable) *redisLocker

Types

type Locker

type Locker interface {
	// TryLock no block
	TryLock(ctx context.Context, key string, expiration time.Duration) (bool, UnLocker, error)
	// Lock block until successful or timed out
	Lock(ctx context.Context, key string, expiration time.Duration) (UnLocker, error)
}

Locker ...

type UnLocker

type UnLocker interface {
	Unlock() error
}

UnLocker ...

Jump to

Keyboard shortcuts

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