重构代码:CacheCleanUtility方法重构,更改相关文件,此方法仅对需要跨域同步缓存的进行封装
This commit is contained in:
parent
c51c659685
commit
a0e827ce82
|
@ -8,7 +8,7 @@ namespace Bootstrap.DataAccess
|
||||||
{
|
{
|
||||||
internal static class CacheCleanUtility
|
internal static class CacheCleanUtility
|
||||||
{
|
{
|
||||||
const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles";
|
private const string RetrieveAllRolesDataKey = "BootstrapAdminRoleMiddleware-RetrieveRoles";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -17,10 +17,8 @@ namespace Bootstrap.DataAccess
|
||||||
/// <param name="groupIds"></param>
|
/// <param name="groupIds"></param>
|
||||||
/// <param name="menuIds"></param>
|
/// <param name="menuIds"></param>
|
||||||
/// <param name="dictIds"></param>
|
/// <param name="dictIds"></param>
|
||||||
/// <param name="logIds"></param>
|
/// <param name="cacheKey"></param>
|
||||||
/// <param name="notifyIds"></param>
|
internal static void ClearCache(string roleIds = null, string userIds = null, string groupIds = null, string menuIds = null, string dictIds = null, string cacheKey = null)
|
||||||
/// <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)
|
|
||||||
{
|
{
|
||||||
var cacheKeys = new List<string>();
|
var cacheKeys = new List<string>();
|
||||||
var corsKeys = new List<string>();
|
var corsKeys = new List<string>();
|
||||||
|
@ -75,20 +73,9 @@ namespace Bootstrap.DataAccess
|
||||||
if (dictIds != null)
|
if (dictIds != null)
|
||||||
{
|
{
|
||||||
cacheKeys.Add(BootstrapDict.RetrieveDictsDataKey + "*");
|
cacheKeys.Add(BootstrapDict.RetrieveDictsDataKey + "*");
|
||||||
|
cacheKeys.Add(DictHelper.RetrieveCategoryDataKey);
|
||||||
corsKeys.Add(BootstrapDict.RetrieveDictsDataKey + "*");
|
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)
|
if (cacheKey != null)
|
||||||
{
|
{
|
||||||
cacheKeys.Add(cacheKey);
|
cacheKeys.Add(cacheKey);
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Bootstrap.DataAccess
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory";
|
internal const string RetrieveCategoryDataKey = "DictHelper-RetrieveDictsCategory";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Bootstrap.DataAccess
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions";
|
private static readonly string RetrieveExceptionsDataKey = "ExceptionHelper-RetrieveExceptions";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Bootstrap.DataAccess
|
||||||
{
|
{
|
||||||
public static class LogHelper
|
public static class LogHelper
|
||||||
{
|
{
|
||||||
internal const string RetrieveLogsDataKey = "LogHelper-RetrieveLogs";
|
private const string RetrieveLogsDataKey = "LogHelper-RetrieveLogs";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询所有日志信息
|
/// 查询所有日志信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -76,7 +76,7 @@ namespace Bootstrap.DataAccess
|
||||||
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@RequestUrl", p.RequestUrl));
|
cmd.Parameters.Add(DBAccessManager.SqlDBAccess.CreateParameter("@RequestUrl", p.RequestUrl));
|
||||||
ret = DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd) == 1;
|
ret = DBAccessManager.SqlDBAccess.ExecuteNonQuery(cmd) == 1;
|
||||||
}
|
}
|
||||||
CacheCleanUtility.ClearCache(logIds: p.Id == 0 ? string.Empty : p.Id.ToString());
|
CacheManager.Clear(RetrieveLogsDataKey);
|
||||||
DeleteLogAsync();
|
DeleteLogAsync();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ namespace Bootstrap.DataAccess
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal const string RetrieveNotificationsDataKey = "NotificationHelper-RetrieveNotifications";
|
|
||||||
private const string PullNotificationsIntervalDataKey = "NotificationHelper-PullNotificationsInterval";
|
private const string PullNotificationsIntervalDataKey = "NotificationHelper-PullNotificationsInterval";
|
||||||
private static readonly List<MessageBody> MessagePool = new List<MessageBody>();
|
private static readonly List<MessageBody> MessagePool = new List<MessageBody>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue