redisson

package module
v0.0.0-...-95eda0b Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: MIT Imports: 8 Imported by: 0

README

go-redisson

介绍

基于redis实现分布式锁

  • 看门狗机制 TODO
  • 可重入锁(Reentrant Lock)
  • 公平锁(Fair Lock)TODO
  • 联锁(MultiLock)TODO
  • 红锁(RedLock)TODO
  • 读写锁(ReadWriteLock)TODO
分布式锁
locker := InitLocker(&Options{
    Addr: "127.0.0.1:6379",
})
locker.Lock("myLock", 30*time.Second)

Documentation

Index

Constants

View Source
const (
	LockReleaseFlag    = 0
	LockReleaseChannel = "LockReleaseChannel"
	LockExpiration     = 30 * time.Second
	LockTimeout        = 5 * time.Second
)
View Source
const (
	// MaximumResponseTimeLimit 最大响应时间
	MaximumResponseTimeLimit = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RLock

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

RLock ...

func NewRLock

func NewRLock(rdb redis.Cmdable) *RLock

NewRLock ...

func (*RLock) Lock

func (rLock *RLock) Lock(name string, args ...time.Duration) error

Lock ...

func (*RLock) TryLock

func (rLock *RLock) TryLock(name string, args ...time.Duration) error

TryLock ...

func (*RLock) UnLock

func (rLock *RLock) UnLock() error

UnLock ...

type RedLock

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

RedLock ...

func NewRedLock

func NewRedLock(name string, rLocks ...*RLock) *RedLock

NewRedLock ...

func (*RedLock) Lock

func (redLock *RedLock) Lock() error

Lock ...

func (*RedLock) TryLock

func (redLock *RedLock) TryLock() error

TryLock ...

func (*RedLock) UnLock

func (redLock *RedLock) UnLock() error

UnLock ...

Jump to

Keyboard shortcuts

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