Documentation
¶
Index ¶
- Constants
- Variables
- func TryLock(redisCli *redis.Client, key string, cb LockResultCB) (err error)
- func TryLockWithTimeout(redisCli *redis.Client, key string, tryTimeout, ownedTimeout time.Duration, ...) (err error)
- func TryReentrantLock(redisCli *redis.Client, key, token string, cb ReentrantLockResultCB) (err error)
- func TryReentrantLockWithTimeout(redisCli *redis.Client, key, token string, ...) (err error)
- type LockResultCB
- type Manager
- func (man *Manager) TryLock(key string, cb LockResultCB) (err error)
- func (man *Manager) TryLockWithTimeout(key string, tryTimeout, ownedTimeout time.Duration, cb LockResultCB) (err error)
- func (man *Manager) TryReentrantLock(key, token string, cb ReentrantLockResultCB) (err error)
- func (man *Manager) TryReentrantLockWithTimeout(key, token string, tryTimeout, ownedTimeout time.Duration, ...) (err error)
- type ReentrantLockResultCB
Constants ¶
View Source
const DefaultOwnedTimeout = 2 * time.Second
DefaultOwnedTimeout is the duration for which the lock is valid
Variables ¶
View Source
var (
ErrNoResultCB = cuserror.NewWithErrorMsg("noResultCB")
)
Functions ¶
func TryLock ¶
func TryLock(redisCli *redis.Client, key string, cb LockResultCB) (err error)
func TryLockWithTimeout ¶
func TryLockWithTimeout(redisCli *redis.Client, key string, tryTimeout, ownedTimeout time.Duration, cb LockResultCB) (err error)
func TryReentrantLock ¶
func TryReentrantLock(redisCli *redis.Client, key, token string, cb ReentrantLockResultCB) (err error)
func TryReentrantLockWithTimeout ¶
func TryReentrantLockWithTimeout(redisCli *redis.Client, key, token string, tryTimeout, ownedTimeout time.Duration, cb ReentrantLockResultCB) (err error)
Types ¶
type LockResultCB ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) TryLockWithTimeout ¶
func (*Manager) TryReentrantLock ¶
func (man *Manager) TryReentrantLock(key, token string, cb ReentrantLockResultCB) (err error)
func (*Manager) TryReentrantLockWithTimeout ¶
type ReentrantLockResultCB ¶
Click to show internal directories.
Click to hide internal directories.