From a4e97ce5cb6ad7e1002d20096cb42272fea82177 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Thu, 6 Apr 2017 12:12:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E4=BB=A3=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=E8=B0=83=E7=94=A8Longbow.V4=E7=BB=84=E4=BB=B6=E5=86=85?= =?UTF-8?q?=E7=9A=84=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98=E6=96=B9=E6=B3=95?= =?UTF-8?q?CacheListSection.ClearCache(cacheKeys)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.DataAccess/CacheCleanUtility.cs | 27 ++--------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/Bootstrap.DataAccess/CacheCleanUtility.cs b/Bootstrap.DataAccess/CacheCleanUtility.cs index 9a051a20..ab6cb2eb 100644 --- a/Bootstrap.DataAccess/CacheCleanUtility.cs +++ b/Bootstrap.DataAccess/CacheCleanUtility.cs @@ -1,11 +1,9 @@ using Bootstrap.Security; 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 { @@ -81,29 +79,8 @@ namespace Bootstrap.DataAccess cacheKeys.Add(ExceptionHelper.RetrieveExceptionsDataKey + "*"); } - cacheKeys.AsParallel().ForAll(key => CacheManager.Clear(k => key.EndsWith("*") ? k.Contains(key.TrimEnd('*')) : k.Equals(key))); - System.Threading.Tasks.Task.Factory.StartNew(() => - { - var section = CacheListSection.GetSection(); - section.Items.Where(item => item.Enabled).Skip(1).AsParallel().ForAll(ele => - { - try - { - using (var client = new WebClient()) - { - cacheKeys.ForEach(k => client.OpenRead(string.Format(ele.Url, k))); - } - } - 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); - } - }); - }); + CacheManager.Clear(k => cacheKeys.Any(key => key.EndsWith("*") ? k.Contains(key.TrimEnd('*')) : key == k)); + CacheListSection.ClearCache(cacheKeys); } } }