| | |
| | | if (!StringUtil.isNullOrEmpty(cacheKey)) {
|
| | | cacheKey = joinPoint.getTarget().getClass().getName() + "." + targetMethod.getName() + "-"
|
| | | + cacheKey;
|
| | | String cacheAlias = cacheKey;
|
| | | cacheKey = "rs-" + StringUtil.Md5(cacheKey);
|
| | | // jiedis原子性做拦截
|
| | | Jedis jedis = jedisPool.getResource();
|
| | |
| | | // 等待响应
|
| | | while (result <= 0) {
|
| | | result = jedis.setnx(cacheKey, "1");
|
| | | LogHelper.error("触发并发锁:" + cacheAlias);
|
| | | LogHelper.error("redis键:" + cacheKey);
|
| | | if (result <= 0) {
|
| | | try {
|
| | | Thread.sleep(50);
|
| | |
| | | out.print(JsonUtil.loadFalseResult("连接超时"));
|
| | | return null;
|
| | | }
|
| | | } else {
|
| | | // 设置30秒处理时间
|
| | | jedis.expire(cacheKey, 30);
|
| | | }
|
| | | }
|
| | |
|