类 CaffeineDistributedLock

java.lang.Object
top.tangyh.basic.cache.lock.CaffeineDistributedLock
所有已实现的接口:
DistributedLock

public class CaffeineDistributedLock extends Object implements DistributedLock
分布式锁 只能用redis实现 写这个类的目的,只是为了防止代码启动报错
作者:
zuihou
  • 构造器详细资料

    • CaffeineDistributedLock

      public CaffeineDistributedLock()
  • 方法详细资料

    • lock

      public boolean lock(String key, long expire, int retryTimes, long sleepMillis)
      从接口复制的说明: DistributedLock
      获取锁
      指定者:
      lock 在接口中 DistributedLock
      参数:
      key - key
      expire - 获取锁超时时间
      retryTimes - 重试次数
      sleepMillis - 获取锁失败的重试间隔
      返回:
      成功/失败
    • releaseLock

      public boolean releaseLock(String key)
      从接口复制的说明: DistributedLock
      释放锁
      指定者:
      releaseLock 在接口中 DistributedLock
      参数:
      key - key值
      返回:
      释放结果