diff --git a/Bootstrap.DataAccess/CacheCleanUtility.cs b/Bootstrap.DataAccess/CacheCleanUtility.cs index a40e20da..7a4b50b7 100644 --- a/Bootstrap.DataAccess/CacheCleanUtility.cs +++ b/Bootstrap.DataAccess/CacheCleanUtility.cs @@ -73,9 +73,9 @@ namespace Bootstrap.DataAccess } if (dictIds != null) { - cacheKeys.Add(Dict.RetrieveDictsDataKey + "*"); + cacheKeys.Add(DictHelper.RetrieveDictsDataKey + "*"); cacheKeys.Add(DictHelper.RetrieveCategoryDataKey); - corsKeys.Add(Dict.RetrieveDictsDataKey + "*"); + corsKeys.Add(DictHelper.RetrieveDictsDataKey + "*"); } if (cacheKey != null) { diff --git a/Bootstrap.DataAccess/Dict.cs b/Bootstrap.DataAccess/Dict.cs index f6ec7bb1..3fcdf758 100644 --- a/Bootstrap.DataAccess/Dict.cs +++ b/Bootstrap.DataAccess/Dict.cs @@ -13,13 +13,6 @@ namespace Bootstrap.DataAccess /// public class Dict : BootstrapDict { - /// - /// - /// - /// - /// 缓存索引,BootstrapAdmin后台清理缓存时使用 - /// - public const string RetrieveDictsDataKey = "BootstrapDict-RetrieveDicts"; /// /// 删除字典中的数据 /// diff --git a/Bootstrap.DataAccess/Helper/DictHelper.cs b/Bootstrap.DataAccess/Helper/DictHelper.cs index b3a98c5c..c9ac38ca 100644 --- a/Bootstrap.DataAccess/Helper/DictHelper.cs +++ b/Bootstrap.DataAccess/Helper/DictHelper.cs @@ -10,12 +10,22 @@ namespace Bootstrap.DataAccess /// public static class DictHelper { + /// + /// + /// + /// + /// 缓存索引,BootstrapAdmin后台清理缓存时使用 + /// + public const string RetrieveDictsDataKey = "BootstrapDict-RetrieveDicts"; + /// + /// + /// public const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory"; /// /// /// /// - public static IEnumerable RetrieveDicts() => DbAdapterManager.Create().RetrieveDicts(); + public static IEnumerable RetrieveDicts() => CacheManager.GetOrAdd(RetrieveDictsDataKey, key => DbAdapterManager.Create().RetrieveDicts()); /// /// 删除字典中的数据 ///