Showing
3 changed files
with
12 additions
and
2 deletions
@@ -27,6 +27,13 @@ public @interface SearchCacheAble { | @@ -27,6 +27,13 @@ public @interface SearchCacheAble { | ||
27 | */ | 27 | */ |
28 | public int cacheInMinute(); | 28 | public int cacheInMinute(); |
29 | 29 | ||
30 | + | ||
31 | + /** | ||
32 | + * 是否需要md5 | ||
33 | + * @return | ||
34 | + */ | ||
35 | + public boolean needMd5() default true; | ||
36 | + | ||
30 | /** | 37 | /** |
31 | * 缓存类型,默认search_redis | 38 | * 缓存类型,默认search_redis |
32 | * | 39 | * |
@@ -126,8 +126,11 @@ public class SearchCacheAspect { | @@ -126,8 +126,11 @@ public class SearchCacheAspect { | ||
126 | private String getRealCacheKey(String value,SearchCacheAble searchCacheAble){ | 126 | private String getRealCacheKey(String value,SearchCacheAble searchCacheAble){ |
127 | StringBuilder realCacheKey = new StringBuilder("YOHOSEARCH:"); | 127 | StringBuilder realCacheKey = new StringBuilder("YOHOSEARCH:"); |
128 | realCacheKey.append(searchCacheAble.cacheName()).append(":"); | 128 | realCacheKey.append(searchCacheAble.cacheName()).append(":"); |
129 | + if(searchCacheAble.needMd5()){ | ||
129 | realCacheKey.append(MD5Util.string2MD5(value)); | 130 | realCacheKey.append(MD5Util.string2MD5(value)); |
131 | + }else{ | ||
132 | + realCacheKey.append(value); | ||
133 | + } | ||
130 | return realCacheKey.toString(); | 134 | return realCacheKey.toString(); |
131 | } | 135 | } |
132 | - | ||
133 | } | 136 | } |
@@ -50,7 +50,7 @@ public class CommonPageRecallService extends BaseRecallService { | @@ -50,7 +50,7 @@ public class CommonPageRecallService extends BaseRecallService { | ||
50 | * @param paramMap | 50 | * @param paramMap |
51 | * @return | 51 | * @return |
52 | */ | 52 | */ |
53 | - @SearchCacheAble(cacheInMinute = 10, cacheName = "COMMON_PAGE_RECALL_BATCH",cacheType=CacheType.EHCACHE,returnClass = CommonRecallResult.class, excludeParams = { "uid", "order", "page" }) | 53 | + @SearchCacheAble(cacheInMinute = 10, needMd5=false,cacheName = "COMMON_PAGE_RECALL_BATCH",cacheType=CacheType.EHCACHE,returnClass = CommonRecallResult.class, excludeParams = { "uid", "order", "page" }) |
54 | public CommonRecallResult doCommonPageRecallBatch(Map<String, String> paramMap) { | 54 | public CommonRecallResult doCommonPageRecallBatch(Map<String, String> paramMap) { |
55 | try { | 55 | try { |
56 | int viewNum = this.getViewNum(paramMap); | 56 | int viewNum = this.getViewNum(paramMap); |
-
Please register or login to post a comment