Package top.tangyh.basic.cache.lock
Class CaffeineDistributedLock
java.lang.Object
top.tangyh.basic.cache.lock.CaffeineDistributedLock
- All Implemented Interfaces:
DistributedLock
分布式锁 只能用redis实现
写这个类的目的,只是为了防止代码启动报错
- Author:
- zuihou
-
Field Summary
Fields inherited from interface top.tangyh.basic.cache.lock.DistributedLock
RETRY_TIMES, SLEEP_MILLIS, TIMEOUT_MILLIS -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CaffeineDistributedLock
public CaffeineDistributedLock()
-
-
Method Details
-
lock
Description copied from interface:DistributedLock获取锁- Specified by:
lockin interfaceDistributedLock- Parameters:
key- keyexpire- 获取锁超时时间retryTimes- 重试次数sleepMillis- 获取锁失败的重试间隔- Returns:
- 成功/失败
-
releaseLock
Description copied from interface:DistributedLock释放锁- Specified by:
releaseLockin interfaceDistributedLock- Parameters:
key- key值- Returns:
- 释放结果
-