Config config = new Config();
config.useSingleServer().setAddress(“redis://127.0.0.1:6379”);
RedissonClient redisson = Redisson.create(config);
RLock lock = redisson.getLock(“lock_key”);
lock.lock();
try {
// 执行业务逻辑
} finally {
lock.unlock();
}
原创文章,作者:IT_admin,如若转载,请注明出处:https://docs.ihr360.com/tech_arch/arch_ability/28418