lock

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	New             func(key Key) Lock
	NewWithDuration func(key Key, duration time.Duration) Lock

	ErrLockNotExist = errors.New("lock not exist")
	ErrLockOccupied = errors.New("lock occupied")
)

Functions

This section is empty.

Types

type Key

type Key string

type Lock

type Lock interface {
	Lock(context.Context) error
	Release(context.Context) error
}

type MysqlLock

type MysqlLock struct {
	// contains filtered or unexported fields
}

func (*MysqlLock) Lock

func (ml *MysqlLock) Lock(ctx context.Context) error

func (*MysqlLock) Release

func (ml *MysqlLock) Release(ctx context.Context) error

type RedisLock

type RedisLock struct {
	// contains filtered or unexported fields
}

func (*RedisLock) Lock

func (rl *RedisLock) Lock(ctx context.Context) error

func (*RedisLock) Release

func (rl *RedisLock) Release(ctx context.Context) error

Jump to

Keyboard shortcuts

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