update 优化 RedisUtils 重构过期方法

This commit is contained in:
疯狂的狮子Li
2022-04-30 22:31:14 +08:00
parent d61757a885
commit 7303af9621
6 changed files with 23 additions and 25 deletions

View File

@@ -22,9 +22,9 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.Duration;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* 防止重复提交(参考美团GTIS防重系统)
@@ -58,7 +58,7 @@ public class RepeatSubmitAspect {
String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey;
String key = RedisUtils.getCacheObject(cacheRepeatKey);
if (key == null) {
RedisUtils.setCacheObject(cacheRepeatKey, "", interval, TimeUnit.MILLISECONDS);
RedisUtils.setCacheObject(cacheRepeatKey, "", Duration.ofMillis(interval));
KEY_CACHE.set(cacheRepeatKey);
} else {
String message = repeatSubmit.message();