Bläddra i källkod

Revert "抽题缓存hash结构"

This reverts commit e4a081a710f9d8de363cc8b8c7e8db5e3d59c78c.
xiatian 1 år sedan
förälder
incheckning
1024437740

+ 5 - 5
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/RandomPaperServiceImpl.java

@@ -1090,7 +1090,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
     private List<Integer> getIndexList(Integer count){
     	List<Integer> ret=new ArrayList<>();
     	for (int i = 0; i < count; i++) {
-    		ret.add(i);
+    		ret.add(count);
     	}
     	return ret;
     }
@@ -1209,7 +1209,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
             	count = 0;
             }
             map.put(rpq.getKey(), count+1);
-            redisClient.set(questionKey,rpq.getKey()+"-"+count, rpq, cacheTimeOut);
+            redisClient.set(questionKey,rpq.getKey()+"_"+count, rpq, cacheTimeOut);
         }
         rp.setQuestionMap(map);
 
@@ -1220,7 +1220,7 @@ public class RandomPaperServiceImpl implements RandomPaperService {
     
     private RandomPaperQuestion getRandomPaperQuestionCacheById(String randomPaperId,String ckey,Integer index) {
     	String questionKey = CacheConstants.CACHE_Q_RANDOM_PAPER_QUESTION + randomPaperId;
-    	String subKey=ckey+"-"+index;
+    	String subKey=ckey+"_"+index;
         // 从redis缓存中获取
     	RandomPaperQuestion rp = redisClient.get(questionKey,subKey, RandomPaperQuestion.class);
         if (rp != null) {
@@ -1243,8 +1243,8 @@ public class RandomPaperServiceImpl implements RandomPaperService {
             	count = 0;
             }
             map.put(rpq.getKey(), count+1);
-            redisClient.set(questionKey,rpq.getKey()+"-"+count, rpq, cacheTimeOut);
-            if(subKey.equals(rpq.getKey()+"-"+count)) {
+            redisClient.set(questionKey,rpq.getKey()+"_"+count, rpq, cacheTimeOut);
+            if(subKey.equals(rpq.getKey()+"_"+count)) {
             	rp=rpq;
             }
         }