From a0e827ce82d70ef4525ba8ea309b22dbe3019cec Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Sun, 9 Sep 2018 19:38:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=9ACa?= =?UTF-8?q?cheCleanUtility=E6=96=B9=E6=B3=95=E9=87=8D=E6=9E=84=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E6=AD=A4=E6=96=B9=E6=B3=95=E4=BB=85=E5=AF=B9=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E8=B7=A8=E5=9F=9F=E5=90=8C=E6=AD=A5=E7=BC=93=E5=AD=98=E7=9A=84?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.DataAccess/CacheCleanUtility.cs | 21 ++++----------------- Bootstrap.DataAccess/DictHelper.cs | 2 +- Bootstrap.DataAccess/ExceptionHelper.cs | 2 +- Bootstrap.DataAccess/LogHelper.cs | 4 ++-- Bootstrap.DataAccess/NotificationHelper.cs | 1 - 5 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Bootstrap.DataAccess/CacheCleanUtility.cs b/Bootstrap.DataAccess/CacheCleanUtility.cs index e496d2f4..14ae66ce 100644 --- a/Bootstrap.DataAccess/CacheCleanUtility.cs +++ b/Bootstrap.DataAccess/CacheCleanUtility.cs @@ -8,7 +8,7 @@ namespace Bootstrap.DataAccess { internal static class CacheCleanUtility { - const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles"; + private const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles"; /// /// /// @@ -17,10 +17,8 @@ namespace Bootstrap.DataAccess /// /// /// - /// - /// - /// - 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) + /// + 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(); var corsKeys = new List(); @@ -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); diff --git a/Bootstrap.DataAccess/DictHelper.cs b/Bootstrap.DataAccess/DictHelper.cs index 89e2764a..51f43eec 100644 --- a/Bootstrap.DataAccess/DictHelper.cs +++ b/Bootstrap.DataAccess/DictHelper.cs @@ -17,7 +17,7 @@ namespace Bootstrap.DataAccess /// /// /// - private const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory"; + internal const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory"; /// /// /// diff --git a/Bootstrap.DataAccess/ExceptionHelper.cs b/Bootstrap.DataAccess/ExceptionHelper.cs index 72e54c10..30ed2dbb 100644 --- a/Bootstrap.DataAccess/ExceptionHelper.cs +++ b/Bootstrap.DataAccess/ExceptionHelper.cs @@ -20,7 +20,7 @@ namespace Bootstrap.DataAccess /// /// /// - public static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions"; + private static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions"; /// /// /// diff --git a/Bootstrap.DataAccess/LogHelper.cs b/Bootstrap.DataAccess/LogHelper.cs index 9afd1007..d46bcd5f 100644 --- a/Bootstrap.DataAccess/LogHelper.cs +++ b/Bootstrap.DataAccess/LogHelper.cs @@ -10,7 +10,7 @@ namespace Bootstrap.DataAccess { public static class LogHelper { - internal const string RetrieveLogsDataKey = "LogHelper-RetrieveLogs"; + private const string RetrieveLogsDataKey = "LogHelper-RetrieveLogs"; /// /// 查询所有日志信息 /// @@ -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; } diff --git a/Bootstrap.DataAccess/NotificationHelper.cs b/Bootstrap.DataAccess/NotificationHelper.cs index 62e47b0a..d5129fed 100644 --- a/Bootstrap.DataAccess/NotificationHelper.cs +++ b/Bootstrap.DataAccess/NotificationHelper.cs @@ -15,7 +15,6 @@ namespace Bootstrap.DataAccess /// /// /// - internal const string RetrieveNotificationsDataKey = "NotificationHelper-RetrieveNotifications"; private const string PullNotificationsIntervalDataKey = "NotificationHelper-PullNotificationsInterval"; private static readonly List MessagePool = new List(); ///