Files
Umbraco-CMS/src/Umbraco.Web/Cache/LanguageCacheRefresher.cs
Shannon Deminick e97a01c75c Fixes: #U4-1992 - Creates DictionaryCacheRefresher to ensure that all cache associated with the dictionary is updated amongst all
servers when it is changed/removed. Removes RemoveByJson as we only actually require RefreshByJson since we can put any sort of parameters
in a custom json string including whether it is a remove operation (if required)
2013-03-23 01:59:25 +06:00

41 lines
1.3 KiB
C#

using System;
using Umbraco.Core;
using Umbraco.Core.Cache;
namespace Umbraco.Web.Cache
{
/// <summary>
/// A cache refresher to ensure language cache is refreshed when languages change
/// </summary>
public sealed class LanguageCacheRefresher : CacheRefresherBase<LanguageCacheRefresher>
{
protected override LanguageCacheRefresher Instance
{
get { return this; }
}
public override Guid UniqueIdentifier
{
get { return new Guid(DistributedCache.LanguageCacheRefresherId); }
}
public override string Name
{
get { return "Language cache refresher"; }
}
public override void Refresh(int id)
{
ApplicationContext.Current.ApplicationCache.ClearCacheItem(CacheKeys.LanguageCacheKey);
base.Refresh(id);
}
public override void Remove(int id)
{
ApplicationContext.Current.ApplicationCache.ClearCacheItem(CacheKeys.LanguageCacheKey);
//when a language is removed we must also clear the text cache!
global::umbraco.cms.businesslogic.language.Item.ClearCache();
base.Remove(id);
}
}
}