|
@@ -664,5 +664,28 @@ public class SearchProductServiceImpl implements SearchProductService {
|
|
|
}
|
|
|
return searchFrequencyVos;
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * redis缓存关键词(把所有的关键词整合到一个字符串中)
|
|
|
+ * 用时从redis取出转成list集合返回给前端进行联动
|
|
|
+ */
|
|
|
+ public void conKeyWord(){
|
|
|
+ List<SearchKeywordyVo> keywordList = searchFrequencyMapper.getKeywordList(null);
|
|
|
+ for (SearchKeywordyVo searchFrequency:keywordList) {
|
|
|
+ String str=searchFrequency.getKeyword();
|
|
|
+ String key="";
|
|
|
+ for(int i=0;i<str.length();i++){
|
|
|
+ key+=str.charAt(i);
|
|
|
+ List<SearchKeywordyVo> searchFrequencyVos = searchFrequencyMapper.getvalueList(key);
|
|
|
+ String keyword = com.alibaba.fastjson.JSONObject.toJSONString(searchFrequencyVos);//有值的字段才转
|
|
|
+ redisService.set(key,keyword,60L * 60 * 24 * 30);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println(redisService.getExpireTime("恩"));
|
|
|
+ System.out.println(redisService.get("恩"));
|
|
|
+ System.out.println(redisService.getExpireTime("光"));
|
|
|
+ System.out.println(redisService.get("光"));
|
|
|
+// System.out.println(redisService.getExpireTime("keyword"));
|
|
|
+// String key=redisService.get("keyword").toString();
|
|
|
+// System.out.println(key);
|
|
|
+ }
|
|
|
}
|