Authored by foxxy

性能优化,两次缓存的时间都一样,没意义的缓存

@@ -49,7 +49,7 @@ public class SearchLikeSecneController { @@ -49,7 +49,7 @@ public class SearchLikeSecneController {
49 return searchLikeInShopService.searchLikeInShop(paramMap); 49 return searchLikeInShopService.searchLikeInShop(paramMap);
50 } 50 }
51 51
52 - @DownGradeAble(key = "searchLikeNotInShop") 52 + //@DownGradeAble(key = "searchLikeNotInShop")
53 @RequestMapping(method = RequestMethod.GET, value = "/searchLikeNotInShop") 53 @RequestMapping(method = RequestMethod.GET, value = "/searchLikeNotInShop")
54 @ResponseBody 54 @ResponseBody
55 public SearchApiResult searchLikeNotInShop(HttpServletRequest request) { 55 public SearchApiResult searchLikeNotInShop(HttpServletRequest request) {
@@ -108,7 +108,7 @@ public class SearchLikeHelper { @@ -108,7 +108,7 @@ public class SearchLikeHelper {
108 * @param productSkn 108 * @param productSkn
109 * @return 109 * @return
110 */ 110 */
111 - public JSONObject getProductInfoInEs(String productSkn) { 111 + protected JSONObject getProductInfoInEs(String productSkn) {
112 SearchParam searchParam = new SearchParam(); 112 SearchParam searchParam = new SearchParam();
113 searchParam.setQuery(QueryBuilders.matchAllQuery()); 113 searchParam.setQuery(QueryBuilders.matchAllQuery());
114 BoolQueryBuilder boolFilter = QueryBuilders.boolQuery(); 114 BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
@@ -118,10 +118,6 @@ public class SearchLikeHelper { @@ -118,10 +118,6 @@ public class SearchLikeHelper {
118 searchParam.setSize(1); 118 searchParam.setSize(1);
119 119
120 String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX; 120 String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
121 - JSONObject jsonObject = searchCacheService.getJSONObjectFromCache(searchLikeSearchCache, productIndexName, searchParam);  
122 - if (jsonObject != null) {  
123 - return jsonObject;  
124 - }  
125 SearchResult searchResult = searchCommonService.doSearch(productIndexName, searchParam); 121 SearchResult searchResult = searchCommonService.doSearch(productIndexName, searchParam);
126 if (searchResult == null) { 122 if (searchResult == null) {
127 return null; 123 return null;
@@ -130,9 +126,8 @@ public class SearchLikeHelper { @@ -130,9 +126,8 @@ public class SearchLikeHelper {
130 if (productLists == null || productLists.isEmpty()) { 126 if (productLists == null || productLists.isEmpty()) {
131 return null; 127 return null;
132 } 128 }
133 - jsonObject = new JSONObject(); 129 + JSONObject jsonObject = new JSONObject();
134 jsonObject.putAll(productLists.get(0)); 130 jsonObject.putAll(productLists.get(0));
135 - searchCacheService.addJSONObjectToCache(searchLikeSearchCache, productIndexName, searchParam, jsonObject);  
136 return jsonObject; 131 return jsonObject;
137 } 132 }
138 133