golock

package module
v0.0.0-...-8573110 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 4 Imported by: 0

README

Distributed Lock for Golang

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTimeout = errors.New("lock timeout")

ErrTimeout indicates timeout when lock

Functions

This section is empty.

Types

type Locker

type Locker interface {
	// Lock supports lock a key
	Lock(key string, expiration, timeout time.Duration) error

	// Unlock supports release a key
	Unlock(key string) error
}

Locker represents the abstract of locker

func NewRedisLocker

func NewRedisLocker(ctx context.Context, client *redis.Client, value string) Locker

NewRedisLocker returns a new redis locker

Jump to

Keyboard shortcuts

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