Authored by foxxy

性能优化

... ... @@ -26,6 +26,13 @@ public @interface SearchCacheAble {
* @return
*/
public int cacheInMinute();
/**
* 是否需要md5
* @return
*/
public boolean needMd5() default true;
/**
* 缓存类型,默认search_redis
... ...
... ... @@ -126,8 +126,11 @@ public class SearchCacheAspect {
private String getRealCacheKey(String value,SearchCacheAble searchCacheAble){
StringBuilder realCacheKey = new StringBuilder("YOHOSEARCH:");
realCacheKey.append(searchCacheAble.cacheName()).append(":");
realCacheKey.append(MD5Util.string2MD5(value));
if(searchCacheAble.needMd5()){
realCacheKey.append(MD5Util.string2MD5(value));
}else{
realCacheKey.append(value);
}
return realCacheKey.toString();
}
}
... ...
... ... @@ -50,7 +50,7 @@ public class CommonPageRecallService extends BaseRecallService {
* @param paramMap
* @return
*/
@SearchCacheAble(cacheInMinute = 10, cacheName = "COMMON_PAGE_RECALL_BATCH",cacheType=CacheType.EHCACHE,returnClass = CommonRecallResult.class, excludeParams = { "uid", "order", "page" })
@SearchCacheAble(cacheInMinute = 10, needMd5=false,cacheName = "COMMON_PAGE_RECALL_BATCH",cacheType=CacheType.EHCACHE,returnClass = CommonRecallResult.class, excludeParams = { "uid", "order", "page" })
public CommonRecallResult doCommonPageRecallBatch(Map<String, String> paramMap) {
try {
int viewNum = this.getViewNum(paramMap);
... ...