deason 5 سال پیش
والد
کامیت
9d01c4c439

+ 9 - 0
examcloud-core-questions-starter/src/main/java/cn/com/qmth/examcloud/core/questions/starter/DemoController.java

@@ -6,9 +6,11 @@ import cn.com.qmth.examcloud.support.cache.CacheHelper;
 import cn.com.qmth.examcloud.support.cache.bean.BasePaperCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.QuestionCacheBean;
 import cn.com.qmth.examcloud.web.support.Naked;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -16,12 +18,15 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.Set;
 
 @Controller
 @RequestMapping("${api_cqb}/")
 public class DemoController {
     private static final Logger log = LoggerFactory.getLogger(DemoController.class);
     @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+    @Autowired
     private BasePaperCache basePaperCache;
     @Autowired
     private QuestionCache questionCache;
@@ -44,6 +49,10 @@ public class DemoController {
         log.info("questionId: " + questionCacheBean.getDefaultQuestion().getId());
         //questionCache.remove(questionId);
 
+        final String patternKey = "Q_QUESTION:*" + questionId;
+        Set<String> keys = redisTemplate.keys(patternKey);
+        log.info(StringUtils.join(keys, ","));
+
         return "ok";
     }