Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLockedState = fmt.Errorf("the current lock is locked") ErrNotHolderLock = fmt.Errorf("it is not the holder can not unlock") )
Functions ¶
This section is empty.
Types ¶
type NoWaitLock ¶
type NoWaitLock struct {
// contains filtered or unexported fields
}
NoWaitLock 基于redis 非等待锁
func NewNoWaitLock ¶
func NewNoWaitLock(client *redis.ClusterClient, key string, timeOut time.Duration) (locker *NoWaitLock, err error)
func (*NoWaitLock) Do ¶
func (n *NoWaitLock) Do(f func() error) (err1 error, err2 error)
Do 对执行函数使用 NoWaitLock 进行同步, err1 返回 回调函数有关的错误, err2 返回 锁有关的错误,
func (*NoWaitLock) Lock ¶
func (n *NoWaitLock) Lock() (err error)
func (*NoWaitLock) UnLock ¶
func (n *NoWaitLock) UnLock() (err error)
Click to show internal directories.
Click to hide internal directories.