locker

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 7 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 interface {
	Lock(ctx context.Context, resource string) (Release, error)
	LockWithtimeout(ctx context.Context, resource string, timeout time.Duration) (Release, error)
}

func InitRedisLocker added in v0.9.0

func InitRedisLocker(logger *zap.Logger, client *redis.Client) Locker

type RedisLocker added in v0.9.0

type RedisLocker struct {
	Timeout time.Duration
	Maxtry  uint

	Logger *zap.Logger
	// contains filtered or unexported fields
}

func (*RedisLocker) Lock added in v0.9.0

func (r *RedisLocker) Lock(ctx context.Context, resource string) (Release, error)

func (*RedisLocker) LockWithtimeout added in v0.9.0

func (r *RedisLocker) LockWithtimeout(ctx context.Context, resource string, timeout time.Duration) (Release, error)

type Release

type Release func(context.Context) error

Jump to

Keyboard shortcuts

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