Jelajahi Sumber

update constants

deason 8 bulan lalu
induk
melakukan
b5b0c319cb

+ 6 - 0
src/main/java/com/qmth/exam/reserve/cache/CacheConstants.java

@@ -5,6 +5,12 @@ package com.qmth.exam.reserve.cache;
  */
 public interface CacheConstants {
 
+    int CACHE_TIME_OUT_1 = 1;
+
+    int CACHE_TIME_OUT_10 = 10;
+
+    int CACHE_TIME_OUT_30 = 30;
+
     /**
      * 某个分类缓存
      * $cache:category:{categoryId}

+ 5 - 5
src/main/java/com/qmth/exam/reserve/cache/impl/ApplyTaskCacheService.java

@@ -59,7 +59,7 @@ public class ApplyTaskCacheService implements CacheConstants {
             return null;
         }
 
-        redisClient.set(cacheKey, value, 6, TimeUnit.HOURS);
+        redisClient.set(cacheKey, value, CACHE_TIME_OUT_10, TimeUnit.MINUTES);
         log.info("SET cacheKey:{} curApplyTaskId:{}", cacheKey, value.getTaskId());
 
         return value;
@@ -82,7 +82,7 @@ public class ApplyTaskCacheService implements CacheConstants {
         }
 
         value = studentService.findStudentApplyNumberById(studentId);
-        redisClient.set(cacheKey, value, 10, TimeUnit.MINUTES);
+        redisClient.set(cacheKey, value, CACHE_TIME_OUT_10, TimeUnit.MINUTES);
         log.info("SET cacheKey:{} value:{}", cacheKey, value);
 
         return value;
@@ -105,7 +105,7 @@ public class ApplyTaskCacheService implements CacheConstants {
         }
 
         value = examSiteService.countExamSiteCapacityById(examSiteId);
-        redisClient.set(cacheKey, value, 10, TimeUnit.MINUTES);
+        redisClient.set(cacheKey, value, CACHE_TIME_OUT_10, TimeUnit.MINUTES);
         log.info("SET cacheKey:{} value:{}", cacheKey, value);
 
         return value;
@@ -130,7 +130,7 @@ public class ApplyTaskCacheService implements CacheConstants {
 
         int value = studentApplyService.countApplyFinishForExamSiteAndTimePeriod(examSiteId, timePeriodId);
         // atomic.set(value);
-        // atomic.expire(30, TimeUnit.DAYS);
+        // atomic.expire(CACHE_TIME_OUT_30, TimeUnit.DAYS);
         // log.info("SET cacheKey:{} value:{}", cacheKey, value);
 
         return value;
@@ -200,7 +200,7 @@ public class ApplyTaskCacheService implements CacheConstants {
                 this.saveStudentApplyRecord(bean);
             }
 
-            redisClient.expire(cacheKey, 30, TimeUnit.DAYS);
+            redisClient.expire(cacheKey, CACHE_TIME_OUT_30, TimeUnit.DAYS);
             return maps;
         }
 

+ 1 - 1
src/main/java/com/qmth/exam/reserve/cache/impl/CategoryCacheService.java

@@ -39,7 +39,7 @@ public class CategoryCacheService implements CacheConstants {
             return null;
         }
 
-        redisClient.set(cacheKey, value, 10, TimeUnit.MINUTES);
+        redisClient.set(cacheKey, value, CACHE_TIME_OUT_10, TimeUnit.MINUTES);
         log.info("SET cacheKey:{}", cacheKey);
 
         return value;

+ 1 - 1
src/main/java/com/qmth/exam/reserve/cache/impl/ExamSiteCacheService.java

@@ -37,7 +37,7 @@ public class ExamSiteCacheService implements CacheConstants {
             return null;
         }
 
-        redisClient.set(cacheKey, value, 10, TimeUnit.MINUTES);
+        redisClient.set(cacheKey, value, CACHE_TIME_OUT_10, TimeUnit.MINUTES);
         log.info("SET cacheKey:{}", cacheKey);
 
         return value;

+ 2 - 2
src/main/java/com/qmth/exam/reserve/cache/impl/OrgCacheService.java

@@ -37,7 +37,7 @@ public class OrgCacheService implements CacheConstants {
             return null;
         }
 
-        redisClient.set(cacheKey, value, 10, TimeUnit.MINUTES);
+        redisClient.set(cacheKey, value, CACHE_TIME_OUT_10, TimeUnit.MINUTES);
         log.info("SET cacheKey:{}", cacheKey);
 
         return value;
@@ -63,7 +63,7 @@ public class OrgCacheService implements CacheConstants {
             return null;
         }
 
-        redisClient.set(CACHE_CURRENT_ORG, value, 6, TimeUnit.HOURS);
+        redisClient.set(CACHE_CURRENT_ORG, value, CACHE_TIME_OUT_10, TimeUnit.MINUTES);
         log.info("SET cacheKey:{} curOrgId:{}", CACHE_CURRENT_ORG, value.getOrgId());
 
         return value;