public void lock(String key, List<Long> idx) {标签:String,idx,lock,redis,unlock,redission,key,id,分布式 From: https://www.cnblogs.com/eternality/p/16879671.html
if (CollectionUtils.isEmpty(idx)) {
return;
}
idx.forEach(id -> {
RLock lock = redissonClient.getLock(key + id);
lock.lock(1, TimeUnit.MINUTES);
});
}
public void unlock(String key, List<Long> idx) {
if (CollectionUtils.isEmpty(idx)) {
return;
}
idx.forEach(id -> {
RLock lock = redissonClient.getLock(key + id);
lock.unlock();
});
}