5f242aa3f6
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.
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using System;
|
|
using Umbraco.Core;
|
|
using Umbraco.Core.Cache;
|
|
using umbraco.cms.businesslogic.member;
|
|
using umbraco.interfaces;
|
|
|
|
namespace Umbraco.Web.Cache
|
|
{
|
|
/// <summary>
|
|
/// A cache refresher to ensure member 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 MemberCacheRefresher : CacheRefresherBase<MemberCacheRefresher>
|
|
{
|
|
|
|
protected override MemberCacheRefresher Instance
|
|
{
|
|
get { return this; }
|
|
}
|
|
|
|
public override Guid UniqueIdentifier
|
|
{
|
|
get { return new Guid(DistributedCache.MemberCacheRefresherId); }
|
|
}
|
|
|
|
public override string Name
|
|
{
|
|
get { return "Clears Member Cache from umbraco.library"; }
|
|
}
|
|
|
|
public override void Refresh(int id)
|
|
{
|
|
ClearCache(id);
|
|
base.Refresh(id);
|
|
}
|
|
|
|
public override void Remove(int id)
|
|
{
|
|
ClearCache(id);
|
|
base.Remove(id);
|
|
}
|
|
|
|
private void ClearCache(int id)
|
|
{
|
|
ApplicationContext.Current.ApplicationCache.
|
|
ClearCacheByKeySearch(string.Format("{0}_{1}", CacheKeys.MemberCacheKey, id));
|
|
}
|
|
}
|
|
} |