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