redisLock

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorFailToPreemptLock = errors.New("[redis-lock] 加锁失败")
	ErrorLockNotExist      = errors.New("[redis-lock] 锁不存在")
)

Functions

This section is empty.

Types

type Client

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

func New

func New(client redis.Cmdable) *Client

func (*Client) TryLock

func (c *Client) TryLock(ctx context.Context, key string, expiration time.Duration) (*Lock, error)

type Lock

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

func (*Lock) Refresh

func (l *Lock) Refresh(ctx context.Context) error

锁续期

func (*Lock) UnLock

func (l *Lock) UnLock(ctx context.Context) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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