浏览代码

rename basic、examwork cache keys.

deason 2 年之前
父节点
当前提交
1cbb6c4eb9

+ 38 - 0
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/CacheConstants.java

@@ -39,6 +39,15 @@ public interface CacheConstants {
      */
     String CACHE_B_SMS_PROP = "$B:SMS_PROP:";
 
+    /**
+     * 缓存 - 课程信息:{courseId}
+     */
+    String CACHE_B_COURSE = "$B:COURSE:";
+
+    /**
+     * 缓存 - 考生信息:{studentId}
+     */
+    String CACHE_B_STUDENT = "$B:STUDENT:";
 
 
     /* #################### 考务模块 #################### */
@@ -48,6 +57,35 @@ public interface CacheConstants {
      */
     String CACHE_E_EXAM = "$E:EXAM:";
 
+    /**
+     * 缓存 - 考试场次信息:{examId}_{examStageId}
+     */
+    String CACHE_E_EXAM_STAGE = "$E:EXAM_STAGE:";
+
+    /**
+     * 缓存 - 考试场次集合信息:{examId}
+     */
+    String CACHE_E_EXAM_STAGES = "$E:EXAM_STAGES:";
+
+    /**
+     * 缓存 - 考试机构设置信息:{examId}_{orgId}
+     */
+    String CACHE_E_EXAM_ORG_SETTINGS = "$E:EXAM_ORG_SETTINGS:";
+
+    /**
+     * 缓存 - 考试机构属性信息:{examId}_{orgId}_{key}
+     */
+    String CACHE_E_EXAM_ORG_PROP = "$E:EXAM_ORG_PROP:";
+
+    /**
+     * 缓存 - 考试学生设置信息:{examId}_{studentId}
+     */
+    String CACHE_E_EXAM_STUDENT_SETTINGS = "$E:EXAM_STUDENT_SETTINGS:";
+
+    /**
+     * 缓存 - 考试学生属性信息:{examId}_{studentId}_{key}
+     */
+    String CACHE_E_EXAM_STUDENT_PROP = "$E:EXAM_STUDENT_PROP:";
 
 
     /* #################### 题库模块 #################### */

+ 9 - 9
examcloud-support/src/main/java/cn/com/qmth/examcloud/support/cache/CacheHelper.java

@@ -156,7 +156,7 @@ public class CacheHelper implements CacheConstants {
      * @author WANGWEI
      */
     public static CourseCacheBean getCourse(Long courseId) {
-        return ObjectRedisCacheProcessor.get("B_COURSE:", new Object[]{courseId},
+        return ObjectRedisCacheProcessor.get(CACHE_B_COURSE, new Object[]{courseId},
                 CourseCacheBean.class, "EC-CORE-BASIC",
                 "cn.com.qmth.examcloud.core.basic.service.cache.CourseCache");
     }
@@ -169,7 +169,7 @@ public class CacheHelper implements CacheConstants {
      * @author WANGWEI
      */
     public static StudentCacheBean getStudent(Long studentId) {
-        return ObjectRedisCacheProcessor.get("B_STUDENT:", new Object[]{studentId},
+        return ObjectRedisCacheProcessor.get(CACHE_B_STUDENT, new Object[]{studentId},
                 StudentCacheBean.class, "EC-CORE-BASIC",
                 "cn.com.qmth.examcloud.core.basic.service.cache.StudentCache");
     }
@@ -183,7 +183,7 @@ public class CacheHelper implements CacheConstants {
      * @author WANGWEI
      */
     public static ExamStudentSettingsCacheBean getExamStudentSettings(Long examId, Long studentId) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_STUDENT_SETTINGS:",
+        return ObjectRedisCacheProcessor.get(CACHE_E_EXAM_STUDENT_SETTINGS,
                 new Object[]{examId, studentId}, ExamStudentSettingsCacheBean.class,
                 "EC-CORE-EXAMWORK",
                 "cn.com.qmth.examcloud.core.examwork.service.cache.ExamStudentSettingsCache");
@@ -200,7 +200,7 @@ public class CacheHelper implements CacheConstants {
      */
     public static ExamStudentPropertyCacheBean getExamStudentProperty(Long examId, Long studentId,
                                                                       String key) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_STUDENT_PROP:",
+        return ObjectRedisCacheProcessor.get(CACHE_E_EXAM_STUDENT_PROP,
                 new Object[]{examId, studentId, key}, ExamStudentPropertyCacheBean.class,
                 "EC-CORE-EXAMWORK",
                 "cn.com.qmth.examcloud.core.examwork.service.cache.ExamStudentPropertyCache");
@@ -215,7 +215,7 @@ public class CacheHelper implements CacheConstants {
      * @author WANGWEI
      */
     public static ExamOrgSettingsCacheBean getExamOrgSettings(Long examId, Long orgId) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_ORG_SETTINGS:", new Object[]{examId, orgId},
+        return ObjectRedisCacheProcessor.get(CACHE_E_EXAM_ORG_SETTINGS, new Object[]{examId, orgId},
                 ExamOrgSettingsCacheBean.class, "EC-CORE-EXAMWORK",
                 "cn.com.qmth.examcloud.core.examwork.service.cache.ExamOrgSettingsCache");
     }
@@ -230,7 +230,7 @@ public class CacheHelper implements CacheConstants {
      * @author WANGWEI
      */
     public static ExamOrgPropertyCacheBean getExamOrgProperty(Long examId, Long orgId, String key) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_ORG_PROP:", new Object[]{examId, orgId, key},
+        return ObjectRedisCacheProcessor.get(CACHE_E_EXAM_ORG_PROP, new Object[]{examId, orgId, key},
                 ExamOrgPropertyCacheBean.class, "EC-CORE-EXAMWORK",
                 "cn.com.qmth.examcloud.core.examwork.service.cache.ExamOrgPropertyCache");
     }
@@ -257,7 +257,7 @@ public class CacheHelper implements CacheConstants {
      * @author WANGWEI
      */
     public static ExamSettingsCacheBean getExamSettings(Long examId) {
-        return ObjectRedisCacheProcessor.get("E_EXAM:", new Object[]{examId},
+        return ObjectRedisCacheProcessor.get(CACHE_E_EXAM, new Object[]{examId},
                 ExamSettingsCacheBean.class, "EC-CORE-EXAMWORK",
                 "cn.com.qmth.examcloud.core.examwork.service.cache.ExamSettingsCache");
     }
@@ -336,7 +336,7 @@ public class CacheHelper implements CacheConstants {
      * @return
      */
     public static ExamStageCacheBean getExamStage(Long examId, Long examStageId) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_STAGE:", new Object[]{examId, examStageId},
+        return ObjectRedisCacheProcessor.get(CACHE_E_EXAM_STAGE, new Object[]{examId, examStageId},
                 ExamStageCacheBean.class, "EC-CORE-EXAMWORK",
                 "cn.com.qmth.examcloud.core.examwork.service.cache.ExamStageCache");
     }
@@ -348,7 +348,7 @@ public class CacheHelper implements CacheConstants {
      * @return
      */
     public static ExamStagesCacheBean getExamStages(Long examId) {
-        return ObjectRedisCacheProcessor.get("E_EXAM_STAGE:", new Object[]{examId},
+        return ObjectRedisCacheProcessor.get(CACHE_E_EXAM_STAGES, new Object[]{examId},
                 ExamStagesCacheBean.class, "EC-CORE-EXAMWORK",
                 "cn.com.qmth.examcloud.core.examwork.service.cache.ExamStagesCache");
     }