Fixes: U4-2793 There doesn't seem to be a way to un-assign a template from a content item with the new API. Fixes issue with content type cache clearing when templates are deleted. Fixes the legacy packager to use the new template service to delete templates which does it in a much more graceful way, otherwise we need to do a try catch.

This commit is contained in:
Shannon
2015-08-05 16:30:21 +02:00
parent 7869f77704
commit edfe1e6d54
7 changed files with 94 additions and 27 deletions

View File

@@ -47,6 +47,14 @@ namespace Umbraco.Web.Cache
public override void Remove(int id)
{
RemoveFromCache(id);
//During removal we need to clear the runtime cache for templates, content and content type instances!!!
// all three of these types are referenced by templates, and the cache needs to be cleared on every server,
// otherwise things like looking up content type's after a template is removed is still going to show that
// it has an associated template.
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<IContent>();
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<IContentType>();
base.Remove(id);
}
@@ -57,8 +65,7 @@ namespace Umbraco.Web.Cache
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
string.Format("{0}{1}", CacheKeys.TemplateFrontEndCacheKey, id));
//need to clear the runtime cache for template instances
//NOTE: This is temp until we implement the correct ApplicationCache and then we can remove the RuntimeCache, etc...
//need to clear the runtime cache for templates
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<ITemplate>();
}