更新功能:菜单修改后,更新子网站的缓存,通过配置文件中的CacheList小节跳转

This commit is contained in:
Argo-Lenovo 2017-01-09 17:17:28 +08:00
parent caa8cd3c3a
commit 462081d454
2 changed files with 25 additions and 1 deletions

View File

@ -1,12 +1,16 @@
using Longbow.Caching;
using Longbow.Caching.Configuration;
using Longbow.ExceptionManagement;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
namespace Bootstrap.DataAccess
{
internal static class CacheCleanUtility
{
private const string CacheListKey = "bd";
/// <summary>
///
/// </summary>
@ -64,6 +68,26 @@ namespace Bootstrap.DataAccess
});
// final cleanup
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();
}
if (dictIds != null)

View File

@ -260,7 +260,7 @@ CREATE TABLE [dbo].[Exceptions](
[UserIp] [varchar](15) NOT NULL,
[ExceptionType] [nvarchar](max) NOT NULL,
[Message] [nvarchar](max) NOT NULL,
[StackTrace] [nvarchar](max) NOT NULL,
[StackTrace] [nvarchar](max) NULL,
[LogTime] [datetime] NOT NULL,
CONSTRAINT [PK_Exceptions] PRIMARY KEY CLUSTERED
(