From a8a0d0cfed8abe193a8ba1b61502ac57e074a76b Mon Sep 17 00:00:00 2001 From: smallchill Date: Tue, 2 Jun 2020 17:22:03 +0800 Subject: [PATCH] =?UTF-8?q?:zap:=20=E4=BC=98=E5=8C=96DictCache=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=8A=A0=E8=BD=BD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/springblade/system/cache/DictCache.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/cache/DictCache.java b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/cache/DictCache.java index 31539360..b7e9cb09 100644 --- a/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/cache/DictCache.java +++ b/blade-service-api/blade-dict-api/src/main/java/org/springblade/system/cache/DictCache.java @@ -40,6 +40,8 @@ public class DictCache { private static final String DICT_VALUE = "dict:value:"; private static final String DICT_LIST = "dict:list:"; + private static final Boolean TENANT_MODE = Boolean.FALSE; + private static IDictClient dictClient; private static IDictClient getDictClient() { @@ -59,7 +61,7 @@ public class DictCache { return CacheUtil.get(DICT_CACHE, DICT_ID, id, () -> { R result = getDictClient().getById(id); return result.getData(); - }); + }, TENANT_MODE); } /** @@ -76,7 +78,7 @@ public class DictCache { dict -> dict.getDictValue().equalsIgnoreCase(dictValue) ).map(Dict::getDictKey).findFirst(); return key.orElse(StringPool.EMPTY); - }); + }, TENANT_MODE); } /** @@ -90,7 +92,7 @@ public class DictCache { return CacheUtil.get(DICT_CACHE, DICT_VALUE + code + StringPool.COLON, String.valueOf(dictKey), () -> { R result = getDictClient().getValue(code, String.valueOf(dictKey)); return result.getData(); - }); + }, TENANT_MODE); } /** @@ -104,7 +106,7 @@ public class DictCache { return CacheUtil.get(DICT_CACHE, DICT_VALUE + code + StringPool.COLON, dictKey, () -> { R result = getDictClient().getValue(code, dictKey); return result.getData(); - }); + }, TENANT_MODE); } /** @@ -117,7 +119,7 @@ public class DictCache { return CacheUtil.get(DICT_CACHE, DICT_LIST, code, () -> { R> result = getDictClient().getList(code); return result.getData(); - }); + }, TENANT_MODE); } }