|
@@ -0,0 +1,43 @@
|
|
|
|
+package cn.com.qmth.examcloud.core.examwork.service.cache;
|
|
|
|
+
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.examcloud.core.examwork.service.ExamService;
|
|
|
|
+import cn.com.qmth.examcloud.support.cache.bean.OrgExamPropertyCacheBean;
|
|
|
|
+import cn.com.qmth.examcloud.web.cache.RandomObjectRedisCache;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+public class OrgExamPropertyCache extends RandomObjectRedisCache<OrgExamPropertyCacheBean> {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ExamService examService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public OrgExamPropertyCacheBean loadFromResource(Object... keys) {
|
|
|
|
+ Long examId = (Long) keys[0];
|
|
|
|
+ Long orgId = (Long) keys[1];
|
|
|
|
+ String key = (String) keys[3];
|
|
|
|
+
|
|
|
|
+ String value = examService.getOrgProperty(examId, orgId, key);
|
|
|
|
+
|
|
|
|
+ OrgExamPropertyCacheBean b = new OrgExamPropertyCacheBean();
|
|
|
|
+ b.setExamId(examId);
|
|
|
|
+ b.setOrgId(orgId);
|
|
|
|
+ b.setKey(key);
|
|
|
|
+ b.setValue(value);
|
|
|
|
+ return b;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected String getKeyPrefix() {
|
|
|
|
+ return "E_ORG_EXAM_PROP:";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ protected int getTimeout() {
|
|
|
|
+ // 5分钟
|
|
|
|
+ return 60 * 5;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|