2013-02-06 09:53:13 +06:00
|
|
|
|
using System;
|
|
|
|
|
|
using Umbraco.Core;
|
2013-03-12 03:00:42 +04:00
|
|
|
|
using Umbraco.Core.Cache;
|
2013-03-12 17:08:31 +04:00
|
|
|
|
using umbraco.cms.businesslogic.member;
|
2013-02-06 09:53:13 +06:00
|
|
|
|
using umbraco.interfaces;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Cache
|
|
|
|
|
|
{
|
2013-03-18 21:18:22 +06:00
|
|
|
|
/// <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>
|
2013-03-21 22:53:58 +06:00
|
|
|
|
public class MemberCacheRefresher : CacheRefresherBase<MemberCacheRefresher>
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
|
|
|
|
|
|
2013-03-21 22:53:58 +06:00
|
|
|
|
protected override MemberCacheRefresher Instance
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2013-03-21 22:53:58 +06:00
|
|
|
|
get { return this; }
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-03-21 22:53:58 +06:00
|
|
|
|
public override Guid UniqueIdentifier
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2013-03-21 22:53:58 +06:00
|
|
|
|
get { return new Guid(DistributedCache.MemberCacheRefresherId); }
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-03-21 22:53:58 +06:00
|
|
|
|
public override string Name
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2013-03-21 22:53:58 +06:00
|
|
|
|
get { return "Clears Member Cache from umbraco.library"; }
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
2013-03-21 22:53:58 +06:00
|
|
|
|
|
|
|
|
|
|
public override void Refresh(int id)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2013-02-07 05:53:59 +06:00
|
|
|
|
ClearCache(id);
|
2013-03-21 22:53:58 +06:00
|
|
|
|
base.Refresh(id);
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
2013-03-21 22:53:58 +06:00
|
|
|
|
public override void Remove(int id)
|
2013-02-06 09:53:13 +06:00
|
|
|
|
{
|
2013-02-07 05:53:59 +06:00
|
|
|
|
ClearCache(id);
|
2013-03-21 22:53:58 +06:00
|
|
|
|
base.Remove(id);
|
2013-02-07 05:53:59 +06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ClearCache(int id)
|
|
|
|
|
|
{
|
|
|
|
|
|
ApplicationContext.Current.ApplicationCache.
|
2013-03-16 01:37:05 +06:00
|
|
|
|
ClearCacheByKeySearch(string.Format("{0}_{1}", CacheKeys.MemberCacheKey, id));
|
2013-02-06 09:53:13 +06:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|