golock

package
v1.0.71 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: MIT 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 added in v1.0.47

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

func NewLock

func NewLock() Lock

func (*Lock) Lock added in v1.0.47

func (l *Lock) Lock() bool

Lock 上锁

func (*Lock) Unlock added in v1.0.47

func (l *Lock) Unlock()

Unlock 解锁

type LockRedis added in v1.0.47

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

func NewLockRedis added in v1.0.47

func NewLockRedis(client *dorm.RedisClient) *LockRedis

func (*LockRedis) Lock added in v1.0.47

func (r *LockRedis) Lock(ctx context.Context, key string, val string, ttl time.Duration) (resp string, err error)

Lock 上锁 key 锁名 val 锁内容 ttl 锁过期时间

func (*LockRedis) LockForever added in v1.0.47

func (r *LockRedis) LockForever(ctx context.Context, key string, val string) (resp string, err error)

LockForever 永远上锁 key 锁名 val 锁内容

func (*LockRedis) Unlock added in v1.0.47

func (r *LockRedis) Unlock(ctx context.Context, key string) error

Unlock 解锁 key 锁名

Jump to

Keyboard shortcuts

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