Showing
1 changed file
with
6 additions
and
31 deletions
service/src/main/java/com/yoho/search/consumer/service/logicService/cache/BasicDataCacheService.java
@@ -32,7 +32,6 @@ public class BasicDataCacheService { | @@ -32,7 +32,6 @@ public class BasicDataCacheService { | ||
32 | 32 | ||
33 | //YOHO | 33 | //YOHO |
34 | private static final String BRAND_CACHE_KEY = "brand"; | 34 | private static final String BRAND_CACHE_KEY = "brand"; |
35 | - private static final String BRAND_NAME_CACHE_KEY = "brandName"; | ||
36 | private static final String SORT_CACHE_KEY = "sort"; | 35 | private static final String SORT_CACHE_KEY = "sort"; |
37 | private static final String SORT_MAP_LIST_CACHE_KEY = "sortMapList"; | 36 | private static final String SORT_MAP_LIST_CACHE_KEY = "sortMapList"; |
38 | private static final String SHOP_CACHE_KEY = "shop"; | 37 | private static final String SHOP_CACHE_KEY = "shop"; |
@@ -56,7 +55,7 @@ public class BasicDataCacheService { | @@ -56,7 +55,7 @@ public class BasicDataCacheService { | ||
56 | private static final String UFO_SORT_RELATION_CACHE_KEY = "ufoSortRelation"; | 55 | private static final String UFO_SORT_RELATION_CACHE_KEY = "ufoSortRelation"; |
57 | private static final String UFO_SORT_RELATION_REVERSE_CACHE_KEY = "ufoSortRelationReverse"; | 56 | private static final String UFO_SORT_RELATION_REVERSE_CACHE_KEY = "ufoSortRelationReverse"; |
58 | 57 | ||
59 | - //有货品牌 | 58 | + //有货 品牌id->品牌 |
60 | LoadingCache<String, Map<Integer, Brand>> brandCache = CacheBuilder.newBuilder() | 59 | LoadingCache<String, Map<Integer, Brand>> brandCache = CacheBuilder.newBuilder() |
61 | .expireAfterWrite(10, TimeUnit.MINUTES) | 60 | .expireAfterWrite(10, TimeUnit.MINUTES) |
62 | .build(new CacheLoader<String, Map<Integer, Brand>>() { | 61 | .build(new CacheLoader<String, Map<Integer, Brand>>() { |
@@ -78,31 +77,7 @@ public class BasicDataCacheService { | @@ -78,31 +77,7 @@ public class BasicDataCacheService { | ||
78 | brandCache.invalidateAll(); | 77 | brandCache.invalidateAll(); |
79 | } | 78 | } |
80 | 79 | ||
81 | - | ||
82 | - //有货品牌名称->id | ||
83 | - LoadingCache<String, Map<String, Integer>> brandNameCache = CacheBuilder.newBuilder() | ||
84 | - .expireAfterWrite(10, TimeUnit.MINUTES) | ||
85 | - .build(new CacheLoader<String, Map<String, Integer>>() { | ||
86 | - public Map<String, Integer> load(String key) { | ||
87 | - return basicDataLogicService.getBrandNameMap(); | ||
88 | - } | ||
89 | - }); | ||
90 | - | ||
91 | - public Map<String, Integer> getBrandNameMap() { | ||
92 | - try { | ||
93 | - return brandNameCache.get(BRAND_NAME_CACHE_KEY); | ||
94 | - } catch (Exception e) { | ||
95 | - logger.error(e.getMessage()); | ||
96 | - return new HashMap<>(); | ||
97 | - } | ||
98 | - } | ||
99 | - | ||
100 | - public void clearBrandName() { | ||
101 | - brandNameCache.invalidateAll(); | ||
102 | - } | ||
103 | - | ||
104 | - | ||
105 | - //有货品类 | 80 | + //有货 品类id->品类 |
106 | LoadingCache<String, Map<Integer, ProductSort>> productSortCache = CacheBuilder.newBuilder() | 81 | LoadingCache<String, Map<Integer, ProductSort>> productSortCache = CacheBuilder.newBuilder() |
107 | .expireAfterWrite(10, TimeUnit.MINUTES) | 82 | .expireAfterWrite(10, TimeUnit.MINUTES) |
108 | .build(new CacheLoader<String, Map<Integer, ProductSort>>() { | 83 | .build(new CacheLoader<String, Map<Integer, ProductSort>>() { |
@@ -125,7 +100,7 @@ public class BasicDataCacheService { | @@ -125,7 +100,7 @@ public class BasicDataCacheService { | ||
125 | } | 100 | } |
126 | 101 | ||
127 | 102 | ||
128 | - //有货店铺 | 103 | + //有货 店铺id->店铺 |
129 | LoadingCache<String, Map<Integer, Shops>> shopCache = CacheBuilder.newBuilder() | 104 | LoadingCache<String, Map<Integer, Shops>> shopCache = CacheBuilder.newBuilder() |
130 | .expireAfterWrite(10, TimeUnit.MINUTES) | 105 | .expireAfterWrite(10, TimeUnit.MINUTES) |
131 | .build(new CacheLoader<String, Map<Integer, Shops>>() { | 106 | .build(new CacheLoader<String, Map<Integer, Shops>>() { |
@@ -148,7 +123,7 @@ public class BasicDataCacheService { | @@ -148,7 +123,7 @@ public class BasicDataCacheService { | ||
148 | } | 123 | } |
149 | 124 | ||
150 | 125 | ||
151 | - //有货颜色id->颜色 | 126 | + //有货 颜色id->颜色 |
152 | LoadingCache<String, Map<Integer, ProductColor>> colorCache = CacheBuilder.newBuilder() | 127 | LoadingCache<String, Map<Integer, ProductColor>> colorCache = CacheBuilder.newBuilder() |
153 | .expireAfterWrite(10, TimeUnit.MINUTES) | 128 | .expireAfterWrite(10, TimeUnit.MINUTES) |
154 | .build(new CacheLoader<String, Map<Integer, ProductColor>>() { | 129 | .build(new CacheLoader<String, Map<Integer, ProductColor>>() { |
@@ -170,7 +145,7 @@ public class BasicDataCacheService { | @@ -170,7 +145,7 @@ public class BasicDataCacheService { | ||
170 | colorCache.invalidateAll(); | 145 | colorCache.invalidateAll(); |
171 | } | 146 | } |
172 | 147 | ||
173 | - //有货颜色名称->颜色 (用于UFO颜色融合) | 148 | + //有货 颜色名称->颜色 (用于UFO颜色融合) |
174 | LoadingCache<String, Map<String, ProductColor>> colorNameCache = CacheBuilder.newBuilder() | 149 | LoadingCache<String, Map<String, ProductColor>> colorNameCache = CacheBuilder.newBuilder() |
175 | .expireAfterWrite(10, TimeUnit.MINUTES) | 150 | .expireAfterWrite(10, TimeUnit.MINUTES) |
176 | .build(new CacheLoader<String, Map<String, ProductColor>>() { | 151 | .build(new CacheLoader<String, Map<String, ProductColor>>() { |
@@ -332,7 +307,7 @@ public class BasicDataCacheService { | @@ -332,7 +307,7 @@ public class BasicDataCacheService { | ||
332 | } | 307 | } |
333 | 308 | ||
334 | 309 | ||
335 | - //全球购用品类映射 | 310 | + //全球购 品类映射 |
336 | LoadingCache<String, List<HashMap<Integer, Integer>>> sortCache = CacheBuilder.newBuilder() | 311 | LoadingCache<String, List<HashMap<Integer, Integer>>> sortCache = CacheBuilder.newBuilder() |
337 | .expireAfterWrite(10, TimeUnit.MINUTES) | 312 | .expireAfterWrite(10, TimeUnit.MINUTES) |
338 | .build(new CacheLoader<String, List<HashMap<Integer, Integer>>>() { | 313 | .build(new CacheLoader<String, List<HashMap<Integer, Integer>>>() { |
-
Please register or login to post a comment