lideyin 5 jaren geleden
bovenliggende
commit
2f57696691

+ 7 - 2
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/pipeline/ClearExamDataCacheExecutor.java

@@ -11,12 +11,14 @@ import cn.com.qmth.examcloud.support.enums.SyncStatus;
 import cn.com.qmth.examcloud.support.examing.ExamBoss;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
 import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
+import cn.com.qmth.examcloud.web.bootstrap.PropertyHolder;
 import cn.com.qmth.examcloud.web.helpers.SequenceLockHelper;
 import cn.com.qmth.examcloud.web.redis.RedisClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @Description 清理考试记录缓存
@@ -81,8 +83,11 @@ public class ClearExamDataCacheExecutor implements NodeExecuter<Long, ExamRecord
                 //清除网考试卷结构
                 redisClient.delete(RedisKeyHelper.getBuilder().studentPaperKey(examRecordDataId));
 
-                //清除考试记录缓存
-                redisClient.delete(RedisKeyHelper.getBuilder().examRecordDataKey(examRecordDataId));
+                //清除考试记录缓存(设置缓存的过期时间)
+                Long defaultExpiredSeconds = PropertyHolder.getLong("oe.student.cache.expiredSeconds", 60);//缓存默认过期时间
+//                redisClient.delete(RedisKeyHelper.getBuilder().examRecordDataKey(examRecordDataId));
+                redisClient.expire(RedisKeyHelper.getBuilder().examRecordDataKey(examRecordDataId),
+                        defaultExpiredSeconds, TimeUnit.SECONDS);
 
                 this.debugLog("all is over.", examRecordDataId);