Fixes: #U4-1930, #U4-1928, #U4-1929 - addes ContentTypeCacheRefresher to ensure that content type cache is cleared

in load balanced scenarios. Cleans up a bit of code too.
This commit is contained in:
Shannon Deminick
2013-03-16 08:47:55 +06:00
parent 2dea4a1d70
commit 23bb0e3ac3
11 changed files with 270 additions and 120 deletions

View File

@@ -210,6 +210,32 @@ namespace Umbraco.Web.Cache
}
}
/// <summary>
/// Remove all cache for a given content type
/// </summary>
/// <param name="dc"></param>
/// <param name="contentType"></param>
public static void RemoveContentTypeCache(this DistributedCache dc, IContentType contentType)
{
if (contentType != null)
{
dc.Remove(new Guid(DistributedCache.ContentTypeCacheRefresherId), x => x.Id, contentType);
}
}
/// <summary>
/// Remove all cache for a given media type
/// </summary>
/// <param name="dc"></param>
/// <param name="mediaType"></param>
public static void RemoveMediaTypeCache(this DistributedCache dc, IMediaType mediaType)
{
if (mediaType != null)
{
dc.Remove(new Guid(DistributedCache.ContentTypeCacheRefresherId), x => x.Id, mediaType);
}
}
/// <summary>
/// Clears the cache for all macros on the current server
/// </summary>