redis

package
v0.0.0-...-b804f52 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lock

type Lock struct {
	Rdb    redis.Cmdable
	Name   string
	Expire time.Duration
	// contains filtered or unexported fields
}

func Newlock

func Newlock(rdb redis.Cmdable, name string, expire time.Duration) *Lock

func (*Lock) BlockLock

func (r *Lock) BlockLock(ctx context.Context, retryNum int, sleepTime time.Duration) bool

BlockLock 带阻塞带锁

func (*Lock) Lock

func (r *Lock) Lock(ctx context.Context) bool

Lock 非阻塞锁

func (*Lock) ReNew

func (r *Lock) ReNew(ctx context.Context) bool

ReNew 续期

func (*Lock) UnLock

func (r *Lock) UnLock(ctx context.Context) bool

UnLock 解锁

Jump to

Keyboard shortcuts

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