|
@@ -436,52 +436,48 @@ public class MetaConfigService { |
|
@@ -436,52 +436,48 @@ public class MetaConfigService { |
436
|
* @param code
|
436
|
* @param code
|
437
|
*/
|
437
|
*/
|
438
|
public void clearCacheByCode(String code){
|
438
|
public void clearCacheByCode(String code){
|
439
|
- switch (code){
|
|
|
440
|
- case "buyer_penalty":
|
|
|
441
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_CANCEL_PENALTY.builderKeyOnlyFixed().getKey());
|
|
|
442
|
- break;
|
|
|
443
|
- case "seller_enter_threshold":
|
|
|
444
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.ENTRY_THRESHOLD.builderKeyOnlyFixed().getKey());
|
|
|
445
|
- break;
|
|
|
446
|
- case "seller_earnest_money":
|
|
|
447
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_EARNEST_MONEY_CONFIG.builderKeyOnlyFixed().getKey());
|
|
|
448
|
- break;
|
|
|
449
|
- case "seller_penalty":
|
|
|
450
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_PENALTY_CONFIG.builderKeyOnlyFixed().getKey());
|
|
|
451
|
- break;
|
|
|
452
|
- case "presale_threshold":
|
|
|
453
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.PRESALE_THRESHOLD.builderKeyOnlyFixed().getKey());
|
|
|
454
|
- break;
|
|
|
455
|
- case "order_code_rule":
|
|
|
456
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.ORDER_CODE_RULE.builderKeyOnlyFixed().getKey());
|
|
|
457
|
- break;
|
|
|
458
|
- case "seller_goods_fee_rate":
|
|
|
459
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_GOODS_FEE_RATE.builderKeyOnlyFixed().getKey());
|
|
|
460
|
- break;
|
|
|
461
|
- case "seller_goods_platform_fee":
|
|
|
462
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_GOODS_PLATFORM_FEE.builderKeyOnlyFixed().getKey());
|
|
|
463
|
- break;
|
|
|
464
|
- case "buyer_order_fee":
|
|
|
465
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_FEE.builderKeyOnlyFixed().getKey());
|
|
|
466
|
- break;
|
|
|
467
|
- case "buyer_overseas_order_cut_policy":
|
|
|
468
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_CUT_POLICY.builderKeyOnlyFixed().getKey());
|
|
|
469
|
- break;
|
|
|
470
|
- case "seller_goods_price_limit":
|
|
|
471
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_SALE_PRICE_LIMIT.builderKeyOnlyFixed().getKey());
|
|
|
472
|
- break;
|
|
|
473
|
- case "depositFee":
|
|
|
474
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.DEPOSIT_PLATFORM_FEE.builderKeyOnlyFixed().getKey());
|
|
|
475
|
- break;
|
|
|
476
|
- case "buyer_bid_config":
|
|
|
477
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_BID_CONFIG.builderKeyOnlyFixed().getKey());
|
|
|
478
|
- break;
|
|
|
479
|
- case "seller_bid_goods_fee_rate":
|
|
|
480
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.SELLER_BID_GOODS_FEE_RATE.builderKeyOnlyFixed().getKey());
|
|
|
481
|
- break;
|
|
|
482
|
- case "buyer_order_violation_penalty":
|
|
|
483
|
- cacheClient.delete(CacheKeyBuilder.KeyTemp.BUYER_ORDER_VIOLATION_PENALTY.builderKeyOnlyFixed().getKey());
|
|
|
484
|
- break;
|
439
|
+ CacheKeyBuilder.KeyTemp cacheKeyTemp = findMetaCodeCacheKeyMap().get(code);
|
|
|
440
|
+ if (Objects.isNull(cacheKeyTemp)){
|
|
|
441
|
+ logger.warn("clearCacheByCode find no cacheKeyTemp, code {}", code);
|
|
|
442
|
+ }else{
|
|
|
443
|
+ logger.info("clearCacheByCode find cacheKeyTemp {}, code {}", cacheKeyTemp, code);
|
|
|
444
|
+ cacheClient.delete(cacheKeyTemp.builderKeyOnlyFixed().getKey());
|
|
|
445
|
+ logger.info("clearCacheByCode finished, cacheKeyTemp {}, code {}", cacheKeyTemp, code);
|
|
|
446
|
+ }
|
|
|
447
|
+ }
|
|
|
448
|
+
|
|
|
449
|
+ /**
|
|
|
450
|
+ * delay load map data
|
|
|
451
|
+ */
|
|
|
452
|
+ private static class DataHold{
|
|
|
453
|
+ private static final Map<String,CacheKeyBuilder.KeyTemp> MetaCodeCacheKeyMap ;
|
|
|
454
|
+
|
|
|
455
|
+ static {
|
|
|
456
|
+ MetaCodeCacheKeyMap = new HashMap<>(16);
|
|
|
457
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_PENALTY, CacheKeyBuilder.KeyTemp.BUYER_CANCEL_PENALTY);
|
|
|
458
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_ENTER_THRESHOLD, CacheKeyBuilder.KeyTemp.ENTRY_THRESHOLD);
|
|
|
459
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_EARNEST_MONEY, CacheKeyBuilder.KeyTemp.SELLER_EARNEST_MONEY_CONFIG);
|
|
|
460
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_PENALTY, CacheKeyBuilder.KeyTemp.SELLER_PENALTY_CONFIG);
|
|
|
461
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.PRESALE_THRESHOLD, CacheKeyBuilder.KeyTemp.PRESALE_THRESHOLD);
|
|
|
462
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.ORDER_CODE_RULE, CacheKeyBuilder.KeyTemp.ORDER_CODE_RULE);
|
|
|
463
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_GOODS_FEE_RATE, CacheKeyBuilder.KeyTemp.SELLER_GOODS_FEE_RATE);
|
|
|
464
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_GOODS_PLATFORM_FEE, CacheKeyBuilder.KeyTemp.SELLER_GOODS_PLATFORM_FEE);
|
|
|
465
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_ORDER_FEE, CacheKeyBuilder.KeyTemp.BUYER_ORDER_FEE);
|
|
|
466
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_OVERSEAS_ORDER_CUT_POLICY, CacheKeyBuilder.KeyTemp.BUYER_ORDER_CUT_POLICY);
|
|
|
467
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_GOODS_PRICE_LIMIT, CacheKeyBuilder.KeyTemp.SELLER_SALE_PRICE_LIMIT);
|
|
|
468
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.DEPOSIT_FEE_POLICY, CacheKeyBuilder.KeyTemp.DEPOSIT_PLATFORM_FEE);
|
|
|
469
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_BID_CONFIG, CacheKeyBuilder.KeyTemp.BUYER_BID_CONFIG);
|
|
|
470
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.SELLER_BID_GOODS_FEE_RATE, CacheKeyBuilder.KeyTemp.SELLER_BID_GOODS_FEE_RATE);
|
|
|
471
|
+ MetaCodeCacheKeyMap.put(MetaConfigKey.BUYER_ORDER_VIOLATION_PENALTY, CacheKeyBuilder.KeyTemp.BUYER_ORDER_VIOLATION_PENALTY);
|
485
|
}
|
472
|
}
|
486
|
}
|
473
|
}
|
|
|
474
|
+
|
|
|
475
|
+
|
|
|
476
|
+ /**
|
|
|
477
|
+ * TODO replace all method of get cache key when time is enough
|
|
|
478
|
+ * @return
|
|
|
479
|
+ */
|
|
|
480
|
+ protected static Map<String,CacheKeyBuilder.KeyTemp> findMetaCodeCacheKeyMap(){
|
|
|
481
|
+ return DataHold.MetaCodeCacheKeyMap;
|
|
|
482
|
+ }
|
487
|
} |
483
|
} |