Converts the media cache refresher to be a json cache refresher since it was impossible before to have media cache
cleared when media was deleted. Created base classes for cache refreshers, we now have a new event - CacheUpdated which can now be used by code to execute on each individual server when any cache refresher is updated. Listening to events normally only fire on the individual server so if people are wanting to refresh their own cache there was previously no way to do that.
This commit is contained in:
@@ -8,35 +8,37 @@ namespace Umbraco.Web.Cache
|
||||
/// <summary>
|
||||
/// Handles User cache invalidation/refreshing
|
||||
/// </summary>
|
||||
public sealed class UserCacheRefresher : ICacheRefresher
|
||||
public sealed class UserCacheRefresher : CacheRefresherBase<UserCacheRefresher>
|
||||
{
|
||||
public Guid UniqueIdentifier
|
||||
protected override UserCacheRefresher Instance
|
||||
{
|
||||
get { return this; }
|
||||
}
|
||||
|
||||
public override Guid UniqueIdentifier
|
||||
{
|
||||
get { return Guid.Parse(DistributedCache.UserCacheRefresherId); }
|
||||
}
|
||||
public string Name
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "User cache refresher"; }
|
||||
}
|
||||
|
||||
public void RefreshAll()
|
||||
public override void RefreshAll()
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(CacheKeys.UserCacheKey);
|
||||
}
|
||||
|
||||
public void Refresh(int id)
|
||||
public override void Refresh(int id)
|
||||
{
|
||||
Remove(id);
|
||||
}
|
||||
|
||||
public void Remove(int id)
|
||||
public override void Remove(int id)
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearCacheItem(string.Format("{0}{1}", CacheKeys.UserCacheKey, id.ToString()));
|
||||
ApplicationContext.Current.ApplicationCache.ClearCacheItem(string.Format("{0}{1}", CacheKeys.UserCacheKey, id));
|
||||
}
|
||||
|
||||
public void Refresh(Guid id)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user