重构代码:CacheCleanUtility方法重构,更改相关文件,此方法仅对需要跨域同步缓存的进行封装

This commit is contained in:
Argo-MacBookPro 2018-09-09 19:38:27 +08:00
parent c51c659685
commit a0e827ce82
5 changed files with 8 additions and 22 deletions

View File

@ -8,7 +8,7 @@ namespace Bootstrap.DataAccess
{
internal static class CacheCleanUtility
{
const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles";
private const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles";
/// <summary>
///
/// </summary>
@ -17,10 +17,8 @@ namespace Bootstrap.DataAccess
/// <param name="groupIds"></param>
/// <param name="menuIds"></param>
/// <param name="dictIds"></param>
/// <param name="logIds"></param>
/// <param name="notifyIds"></param>
/// <param name="exceptionIds"></param>
internal static void ClearCache(string roleIds = null, string userIds = null, string groupIds = null, string menuIds = null, string dictIds = null, string logIds = null, string notifyIds = null, string exceptionIds = null, string cacheKey = null)
/// <param name="cacheKey"></param>
internal static void ClearCache(string roleIds = null, string userIds = null, string groupIds = null, string menuIds = null, string dictIds = null, string cacheKey = null)
{
var cacheKeys = new List<string>();
var corsKeys = new List<string>();
@ -75,20 +73,9 @@ namespace Bootstrap.DataAccess
if (dictIds != null)
{
cacheKeys.Add(BootstrapDict.RetrieveDictsDataKey + "*");
cacheKeys.Add(DictHelper.RetrieveCategoryDataKey);
corsKeys.Add(BootstrapDict.RetrieveDictsDataKey + "*");
}
if (logIds != null)
{
cacheKeys.Add(LogHelper.RetrieveLogsDataKey + "*");
}
if (notifyIds != null)
{
cacheKeys.Add(NotificationHelper.RetrieveNotificationsDataKey + "*");
}
if (exceptionIds != null)
{
cacheKeys.Add(ExceptionHelper.RetrieveExceptionsDataKey + "*");
}
if (cacheKey != null)
{
cacheKeys.Add(cacheKey);

View File

@ -17,7 +17,7 @@ namespace Bootstrap.DataAccess
/// <summary>
///
/// </summary>
private const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory";
internal const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory";
/// <summary>
///
/// </summary>

View File

@ -20,7 +20,7 @@ namespace Bootstrap.DataAccess
/// <summary>
///
/// </summary>
public static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions";
private static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions";
/// <summary>
///
/// </summary>

View File

@ -10,7 +10,7 @@ namespace Bootstrap.DataAccess
{
public static class LogHelper
{
internal const string RetrieveLogsDataKey = "LogHelper-RetrieveLogs";
private const string RetrieveLogsDataKey = "LogHelper-RetrieveLogs";
/// <summary>
/// 查询所有日志信息
/// </summary>
@ -76,7 +76,7 @@ namespace Bootstrap.DataAccess
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@RequestUrl", p.RequestUrl));
ret = DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd) == 1;
}
CacheCleanUtility.ClearCache(logIds: p.Id == 0 ? string.Empty : p.Id.ToString());
CacheManager.Clear(RetrieveLogsDataKey);
DeleteLogAsync();
return ret;
}

View File

@ -15,7 +15,6 @@ namespace Bootstrap.DataAccess
/// <summary>
///
/// </summary>
internal const string RetrieveNotificationsDataKey = "NotificationHelper-RetrieveNotifications";
private const string PullNotificationsIntervalDataKey = "NotificationHelper-PullNotificationsInterval";
private static readonly List<MessageBody> MessagePool = new List<MessageBody>();
/// <summary>