Pārlūkot izejas kodu

redis设置 过期时间

miaolijing 3 gadi atpakaļ
vecāks
revīzija
2136174523

+ 2 - 2
src/main/java/com/persagy/apm/diagnose/utils/RedisLock.java

@@ -61,8 +61,8 @@ public class RedisLock {
 
     public void sendDataLock(String key, String value) {
 //	    redisTemplate.opsForHash().put("ALARM-DATA-LOCK",key,value);
-        redisTemplate.opsForValue().setIfAbsent(key, value);
-        redisTemplate.expire(key,10, TimeUnit.SECONDS);
+        redisTemplate.opsForValue().setIfAbsent(key, value,10,TimeUnit.SECONDS);
+//        redisTemplate.expire(key,10, TimeUnit.SECONDS);
     }
 
 }