Moves clearing of the routes cache for when domains are changed to the DomainCacheRefresher.

This commit is contained in:
Shannon Deminick
2013-03-22 05:15:58 +06:00
parent e8dd56786b
commit 8cdfba42d5
3 changed files with 16 additions and 11 deletions

View File

@@ -220,8 +220,7 @@ namespace Umbraco.Web.Cache
if (payloads.Any(x => x.Type == typeof(IContentType).Name)
&& !payloads.All(x => x.IsNew)) //if they are all new then don't proceed
{
//we need to clear the routes cache here!
//TODO: Is there a better way to handle this without casting ?
//we need to clear the routes cache here!
var contentCache = PublishedContentCacheResolver.Current.ContentCache as PublishedContentCache;
if (contentCache != null)
{

View File

@@ -1,6 +1,8 @@
using System;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.PublishedCache.LegacyXmlCache;
namespace Umbraco.Web.Cache
{
@@ -26,14 +28,25 @@ namespace Umbraco.Web.Cache
public override void Refresh(int id)
{
ApplicationContext.Current.ApplicationCache.ClearCacheItem(CacheKeys.DomainCacheKey);
ClearCache();
base.Refresh(id);
}
public override void Remove(int id)
{
ApplicationContext.Current.ApplicationCache.ClearCacheItem(CacheKeys.DomainCacheKey);
ClearCache();
base.Remove(id);
}
private void ClearCache()
{
ApplicationContext.Current.ApplicationCache.ClearCacheItem(CacheKeys.DomainCacheKey);
//we need to clear the routes cache here!
var contentCache = PublishedContentCacheResolver.Current.ContentCache as PublishedContentCache;
if (contentCache != null)
{
contentCache.RoutesCache.Clear();
}
}
}
}