Jelajahi Sumber

接口修改

zhanghao 3 minggu lalu
induk
melakukan
68f529a64d

+ 3 - 3
project-common/src/main/java/com/project/common/core/redis/MyCache.java

@@ -39,7 +39,7 @@ public class MyCache {
     @PostConstruct
     public void init() {
         caffeineCache = Caffeine.newBuilder()
-                .expireAfterWrite(30, TimeUnit.MINUTES) // 设置缓存过期时间
+                .expireAfterWrite(30, TimeUnit.DAYS) // 设置缓存过期时间
                 .maximumSize(1000) // 设置缓存最大容量
                 .recordStats() // 启用缓存统计
                 .build();
@@ -77,7 +77,7 @@ public class MyCache {
         LocalDateTime createTimePlus30 = cache.getCreateTime().toInstant()
                 .atZone(java.time.ZoneId.systemDefault())
                 .toLocalDateTime()
-                .plusMinutes(cache.getExpirationDate());
+                .plusDays(cache.getExpirationDate());
         LocalDateTime now = LocalDateTime.now();
         if (createTimePlus30.isBefore(now)){
             platCacheMapper.deleteCache(key);
@@ -121,7 +121,7 @@ public class MyCache {
         LocalDateTime createTimePlus30 = cache.getCreateTime().toInstant()
                 .atZone(java.time.ZoneId.systemDefault())
                 .toLocalDateTime()
-                .plusMinutes(cache.getExpirationDate());
+                .plusDays(cache.getExpirationDate());
         LocalDateTime now = LocalDateTime.now();
         if (createTimePlus30.isBefore(now)){
             platCacheMapper.deleteCache(key.toString());

+ 2 - 2
project-common/src/main/resources/mapper/common.cache/PlatCacheMapper.xml

@@ -23,7 +23,7 @@
 
     <insert id="insertCache">
         insert into large_plat_cache(`key`,`data`,expiration_date,create_time)
-        values (#{arg0},#{arg1},129600,sysdate())
+        values (#{arg0},#{arg1},30,sysdate())
     </insert>
 
     <delete id="deleteCache" parameterType="String">
@@ -47,7 +47,7 @@
         FROM
             large_plat_cache
         WHERE
-            DATE_ADD( create_time, INTERVAL 129600 MINUTE ) > SYSDATE()
+            DATE_ADD( create_time, INTERVAL 30 DAY ) > SYSDATE()
     </select>
 
     <delete id="clearAll">