更新功能:菜单修改后,更新子网站的缓存,通过配置文件中的CacheList小节跳转
This commit is contained in:
parent
caa8cd3c3a
commit
462081d454
|
@ -1,12 +1,16 @@
|
||||||
using Longbow.Caching;
|
using Longbow.Caching;
|
||||||
|
using Longbow.Caching.Configuration;
|
||||||
|
using Longbow.ExceptionManagement;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
namespace Bootstrap.DataAccess
|
namespace Bootstrap.DataAccess
|
||||||
{
|
{
|
||||||
internal static class CacheCleanUtility
|
internal static class CacheCleanUtility
|
||||||
{
|
{
|
||||||
|
private const string CacheListKey = "bd";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -64,6 +68,26 @@ namespace Bootstrap.DataAccess
|
||||||
});
|
});
|
||||||
// final cleanup
|
// final cleanup
|
||||||
CacheManager.Clear(key => cacheKeys.Any(k => k == key) || key.Contains(MenuHelper.RetrieveMenusDataKey));
|
CacheManager.Clear(key => cacheKeys.Any(k => k == key) || key.Contains(MenuHelper.RetrieveMenusDataKey));
|
||||||
|
var section = CacheListSection.GetSection();
|
||||||
|
section.Items.Where(item => item.Enabled && item.Key != CacheListKey).AsParallel().ForAll(ele =>
|
||||||
|
{
|
||||||
|
System.Threading.Tasks.Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var client = new WebClient();
|
||||||
|
client.OpenRead(new Uri(string.Format(ele.Url, MenuHelper.RetrieveMenusDataKey + "*")));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Collections.Specialized.NameValueCollection nv = new System.Collections.Specialized.NameValueCollection();
|
||||||
|
nv["ErrorPage"] = ele.Url;
|
||||||
|
nv["UserId"] = "system";
|
||||||
|
nv["UserIp"] = "::1";
|
||||||
|
ExceptionManager.Publish(ex, nv);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
cacheKeys.Clear();
|
cacheKeys.Clear();
|
||||||
}
|
}
|
||||||
if (dictIds != null)
|
if (dictIds != null)
|
||||||
|
|
|
@ -260,7 +260,7 @@ CREATE TABLE [dbo].[Exceptions](
|
||||||
[UserIp] [varchar](15) NOT NULL,
|
[UserIp] [varchar](15) NOT NULL,
|
||||||
[ExceptionType] [nvarchar](max) NOT NULL,
|
[ExceptionType] [nvarchar](max) NOT NULL,
|
||||||
[Message] [nvarchar](max) NOT NULL,
|
[Message] [nvarchar](max) NOT NULL,
|
||||||
[StackTrace] [nvarchar](max) NOT NULL,
|
[StackTrace] [nvarchar](max) NULL,
|
||||||
[LogTime] [datetime] NOT NULL,
|
[LogTime] [datetime] NOT NULL,
|
||||||
CONSTRAINT [PK_Exceptions] PRIMARY KEY CLUSTERED
|
CONSTRAINT [PK_Exceptions] PRIMARY KEY CLUSTERED
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in New Issue