U4-6797 - clear domains cache when deleting content

This commit is contained in:
Stephan
2015-10-16 17:21:44 +02:00
parent 3a5a32c65f
commit 64f05e4c97
2 changed files with 14 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ using Umbraco.Core.Events;
using Umbraco.Core.Models;
using umbraco;
using umbraco.cms.businesslogic.web;
using Umbraco.Core.Persistence.Repositories;
namespace Umbraco.Web.Cache
{
@@ -400,6 +401,12 @@ namespace Umbraco.Web.Cache
dc.Remove(DistributedCache.DomainCacheRefresherGuid, domain.Id);
}
public static void ClearDomainCacheOnCurrentServer(this DistributedCache dc)
{
var key = RepositoryBase.GetCacheTypeKey<IDomain>();
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(key);
}
#endregion
#region Language Cache

View File

@@ -79,6 +79,7 @@ namespace Umbraco.Web.Cache
{
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<IContent>();
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<PublicAccessEntry>();
DistributedCache.Instance.ClearDomainCacheOnCurrentServer();
base.RefreshAll();
}
@@ -87,6 +88,7 @@ namespace Umbraco.Web.Cache
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(id));
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<PublicAccessEntry>();
content.Instance.UpdateSortOrder(id);
DistributedCache.Instance.ClearDomainCacheOnCurrentServer();
base.Refresh(id);
}
@@ -94,6 +96,7 @@ namespace Umbraco.Web.Cache
{
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(id));
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<PublicAccessEntry>();
DistributedCache.Instance.ClearDomainCacheOnCurrentServer();
base.Remove(id);
}
@@ -103,6 +106,7 @@ namespace Umbraco.Web.Cache
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(instance.Id));
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<PublicAccessEntry>();
content.Instance.UpdateSortOrder(instance);
DistributedCache.Instance.ClearDomainCacheOnCurrentServer();
base.Refresh(instance);
}
@@ -110,6 +114,7 @@ namespace Umbraco.Web.Cache
{
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(instance.Id));
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<PublicAccessEntry>();
DistributedCache.Instance.ClearDomainCacheOnCurrentServer();
base.Remove(instance);
}
@@ -127,6 +132,8 @@ namespace Umbraco.Web.Cache
content.Instance.UpdateSortOrder(payload.Id);
}
DistributedCache.Instance.ClearDomainCacheOnCurrentServer();
OnCacheUpdated(Instance, new CacheRefresherEventArgs(jsonPayload, MessageType.RefreshByJson));
}