Documentation
¶
Overview ¶
Package concurrent 提供业务级别的资源锁 用于为同一种业务对象提供互斥锁机制 内置提供内存模式资源锁
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Locker ¶
type Locker interface {
// Apply 锁定一个用 flag 标记的资源
// @flag 标记资源的 flag
// @releaseDuration 自动释放的时间间隔
// returns 是否能获取到锁
Apply(flag string, releaseDuration ...time.Duration) bool
// Release 释放一个用 flag 标记的资源
Release(flag string)
// Locked 查询并返回一个资源是否被锁定
Locked(flag string) bool
}
Locker 定义资源锁接口
Click to show internal directories.
Click to hide internal directories.