重构代码:移动Dict类中的缓存到DictHelper类中
This commit is contained in:
parent
81fce99357
commit
2a39f1db4c
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -13,13 +13,6 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
public class Dict : BootstrapDict
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// 缓存索引,BootstrapAdmin后台清理缓存时使用
|
||||
/// </summary>
|
||||
public const string RetrieveDictsDataKey = "BootstrapDict-RetrieveDicts";
|
||||
/// <summary>
|
||||
/// 删除字典中的数据
|
||||
/// </summary>
|
||||
|
|
|
@ -10,12 +10,22 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
public static class DictHelper
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// 缓存索引,BootstrapAdmin后台清理缓存时使用
|
||||
/// </summary>
|
||||
public const string RetrieveDictsDataKey = "BootstrapDict-RetrieveDicts";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable<BootstrapDict> RetrieveDicts() => DbAdapterManager.Create<Dict>().RetrieveDicts();
|
||||
public static IEnumerable<BootstrapDict> RetrieveDicts() => CacheManager.GetOrAdd(RetrieveDictsDataKey, key => DbAdapterManager.Create<Dict>().RetrieveDicts());
|
||||
/// <summary>
|
||||
/// 删除字典中的数据
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue