Authored by foxxy

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

... ... @@ -49,7 +49,7 @@ public class SearchLikeSecneController {
return searchLikeInShopService.searchLikeInShop(paramMap);
}
@DownGradeAble(key = "searchLikeNotInShop")
//@DownGradeAble(key = "searchLikeNotInShop")
@RequestMapping(method = RequestMethod.GET, value = "/searchLikeNotInShop")
@ResponseBody
public SearchApiResult searchLikeNotInShop(HttpServletRequest request) {
... ...
... ... @@ -108,7 +108,7 @@ public class SearchLikeHelper {
* @param productSkn
* @return
*/
public JSONObject getProductInfoInEs(String productSkn) {
protected JSONObject getProductInfoInEs(String productSkn) {
SearchParam searchParam = new SearchParam();
searchParam.setQuery(QueryBuilders.matchAllQuery());
BoolQueryBuilder boolFilter = QueryBuilders.boolQuery();
... ... @@ -118,10 +118,6 @@ public class SearchLikeHelper {
searchParam.setSize(1);
String productIndexName = ISearchConstants.INDEX_NAME_PRODUCT_INDEX;
JSONObject jsonObject = searchCacheService.getJSONObjectFromCache(searchLikeSearchCache, productIndexName, searchParam);
if (jsonObject != null) {
return jsonObject;
}
SearchResult searchResult = searchCommonService.doSearch(productIndexName, searchParam);
if (searchResult == null) {
return null;
... ... @@ -130,9 +126,8 @@ public class SearchLikeHelper {
if (productLists == null || productLists.isEmpty()) {
return null;
}
jsonObject = new JSONObject();
JSONObject jsonObject = new JSONObject();
jsonObject.putAll(productLists.get(0));
searchCacheService.addJSONObjectToCache(searchLikeSearchCache, productIndexName, searchParam, jsonObject);
return jsonObject;
}
... ...