WANG il y a 5 ans
Parent
commit
6a5623b95a

+ 1 - 4
src/main/java/cn/com/qmth/examcloud/web/redis/SimpleRedisClient.java

@@ -126,10 +126,7 @@ public final class SimpleRedisClient implements RedisClient {
 	public Boolean setIfAbsent(String key, String value, int timeout) {
 		long s = System.currentTimeMillis();
 		beforeMethod();
-		Boolean b = redisTemplate.opsForValue().setIfAbsent(key, value);
-		if (b) {
-			expire(key, timeout);
-		}
+		Boolean b = redisTemplate.opsForValue().setIfAbsent(key, value, timeout, TimeUnit.SECONDS);
 		afterMethod("setIfAbsent(String key, String value, int timeout)", s);
 		return b;
 	}