Files
Umbraco-CMS/src/Umbraco.Web/Cache/TemplateCacheRefresher.cs

60 lines
1.4 KiB
C#
Raw Normal View History

using System;
using Umbraco.Core;
2013-03-12 03:00:42 +04:00
using Umbraco.Core.Cache;
using umbraco;
using umbraco.interfaces;
namespace Umbraco.Web.Cache
{
/// <summary>
/// A cache refresher to ensure template cache is updated when members change
/// </summary>
/// <remarks>
/// This is not intended to be used directly in your code and it should be sealed but due to legacy code we cannot seal it.
/// </remarks>
public class TemplateCacheRefresher : ICacheRefresher
{
2013-03-12 03:00:42 +04:00
public string Name
{
get
{
return "Template cache refresher";
}
}
public Guid UniqueIdentifier
{
get
{
return new Guid(DistributedCache.TemplateRefresherId);
}
}
public void RefreshAll()
{
}
public void Refresh(Guid id)
{
}
public void Refresh(int id)
{
RemoveFromCache(id);
}
public void Remove(int id)
{
RemoveFromCache(id);
}
private void RemoveFromCache(int id)
{
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(
2013-03-12 03:00:42 +04:00
string.Format("{0}{1}", CacheKeys.TemplateCacheKey, id));
}
}
}