All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Login


All New Login

All gists matching topic springboot

Recently created
Least recently created
Recently updated
Least recently updated

waynelone / Spring boot 中 Redis 实现简易分布式锁

0 likes
0 forks
3 files
Last active 5 months ago
Spring boot 中 Redis 实现简易分布式锁
redis springboot
1 DistributedLockParam lockParam = null;
2 try {
3 lockParam = new DistributedLockParam("test:lock:key");
4 boolean lockOk = distributedLock.lock(lockParam);
5 if (!lockOk) {
6 return new Result().error("系统繁忙,请稍候重试");
7 }
8 // 执行业务逻辑
9 } finally {
10 // 最后强制解锁
Newer Older

Powered by Opengist ⋅ Load: 21ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文