springboot redis分布式锁实现方式 阿磊Arley 2020-01-14 116 阅读1分钟 public Boolean getLock(String key, long timeout, TimeUnit unit) { return redisTemplate.opsForValue().setIfAbsent(key, key, timeout, unit); }这种方式必须springboot2.x版本的