golock

package
v1.0.50 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT Imports: 6 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 LockEtcd added in v1.0.47

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

func NewLockEtcd added in v1.0.47

func NewLockEtcd(etcdClient *clientv3.Client) *LockEtcd

func (*LockEtcd) Lock added in v1.0.47

func (e *LockEtcd) Lock(key string, val string, ttl int64) (string, error)

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

func (*LockEtcd) LockForever added in v1.0.47

func (e *LockEtcd) LockForever(key string, val string) (string, error)

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

func (*LockEtcd) Unlock added in v1.0.47

func (e *LockEtcd) Unlock(key string) error

Unlock 解锁 key 锁名

type LockRedis added in v1.0.47

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

func NewLockRedis added in v1.0.47

func NewLockRedis(redisClient *redis.Client) *LockRedis

func (*LockRedis) Lock added in v1.0.47

func (r *LockRedis) Lock(key string, val string, ttl int64) (string, error)

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

func (*LockRedis) LockForever added in v1.0.47

func (r *LockRedis) LockForever(key string, val string) (string, error)

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

func (*LockRedis) Unlock added in v1.0.47

func (r *LockRedis) Unlock(key string) error

Unlock 解锁 key 锁名

Jump to

Keyboard shortcuts

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