Todos Novo

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

Entrar


Todos Novo Entrar

All gists matching topic redis

Mais recente criado
Menos recente criado
Mais recente atualizado
Menos recente atualizado

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

0 curtidas
0 bifurcações
3 arquivos
Última atividade 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 // 最后强制解锁
Próximo Anterior

Desenvolvido por Opengist ⋅ Load: 22ms⋅

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