Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LockRetryOptions ¶
LockRetryOptions 重试选项
type MemcacheDLocker ¶
type MemcacheDLocker struct {
// contains filtered or unexported fields
}
MemcacheDLocker MC分布式锁
func NewMemcacheDLocker ¶
func NewMemcacheDLocker(mc *memcache.Client) *MemcacheDLocker
NewMemcacheDLocker 新建一个locker对象
func (*MemcacheDLocker) Lock ¶
func (l *MemcacheDLocker) Lock(key string, expiration int32, opt LockRetryOptions) (bool, error)
Lock 给key加锁 key: MC对应的key expiration: 过期时间 单位秒 opt: 重试选项
func (*MemcacheDLocker) Unlock ¶
func (l *MemcacheDLocker) Unlock(key string, opt LockRetryOptions) error
Unlock 释放某个key锁 key: MC对应的key opt: 重试选项
Click to show internal directories.
Click to hide internal directories.