rdlock

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 6 Imported by: 0

README

All distributed locks implemented with Go and redis

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DistributeLock

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

func NewDistributeLock

func NewDistributeLock(rds *redis.Client, key string, expiredSecond int) *DistributeLock

func (*DistributeLock) Lock

func (d *DistributeLock) Lock(ctx context.Context) (ok bool, err error)

func (*DistributeLock) Unlock

func (d *DistributeLock) Unlock(ctx context.Context) (ok bool, err error)

type RenewableDistributeLock

type RenewableDistributeLock struct {
	*DistributeLock
}

RenewableDistributeLock renewable distribute lock

func NewRenewableDistributeLock

func NewRenewableDistributeLock(rds *redis.Client, key string, expiredSecond int) *RenewableDistributeLock

func (*RenewableDistributeLock) Lock

func (l *RenewableDistributeLock) Lock(ctx context.Context) (ok bool, err error)

Jump to

Keyboard shortcuts

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