Remove legacy member cache refresher and unused typed cache refresher base class
This commit is contained in:
@@ -12,13 +12,11 @@ namespace Umbraco.Cms.Core.Cache
|
||||
public sealed class MemberCacheRefresher : PayloadCacheRefresherBase<MemberCacheRefresher, MemberCacheRefresher.JsonPayload>
|
||||
{
|
||||
private readonly IIdKeyMap _idKeyMap;
|
||||
private readonly LegacyMemberCacheRefresher _legacyMemberRefresher;
|
||||
|
||||
public MemberCacheRefresher(AppCaches appCaches, IJsonSerializer serializer, IIdKeyMap idKeyMap)
|
||||
: base(appCaches, serializer)
|
||||
{
|
||||
_idKeyMap = idKeyMap;
|
||||
_legacyMemberRefresher = new LegacyMemberCacheRefresher(this, appCaches);
|
||||
}
|
||||
|
||||
public class JsonPayload
|
||||
@@ -66,12 +64,6 @@ namespace Umbraco.Cms.Core.Cache
|
||||
base.Remove(id);
|
||||
}
|
||||
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
public void Refresh(IMember instance) => _legacyMemberRefresher.Refresh(instance);
|
||||
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
|
||||
public void Remove(IMember instance) => _legacyMemberRefresher.Remove(instance);
|
||||
|
||||
private void ClearCache(params JsonPayload[] payloads)
|
||||
{
|
||||
AppCaches.ClearPartialViewCache();
|
||||
@@ -99,38 +91,5 @@ namespace Umbraco.Cms.Core.Cache
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Backwards Compat
|
||||
|
||||
// TODO: this is here purely for backwards compat but should be removed in netcore
|
||||
private class LegacyMemberCacheRefresher : TypedCacheRefresherBase<MemberCacheRefresher, IMember>
|
||||
{
|
||||
private readonly MemberCacheRefresher _parent;
|
||||
|
||||
public LegacyMemberCacheRefresher(MemberCacheRefresher parent, AppCaches appCaches) : base(appCaches)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override Guid RefresherUniqueId => _parent.RefresherUniqueId;
|
||||
|
||||
public override string Name => _parent.Name;
|
||||
|
||||
protected override MemberCacheRefresher This => _parent;
|
||||
|
||||
public override void Refresh(IMember instance)
|
||||
{
|
||||
_parent.ClearCache(new JsonPayload(instance.Id, instance.Username));
|
||||
base.Refresh(instance.Id);
|
||||
}
|
||||
|
||||
public override void Remove(IMember instance)
|
||||
{
|
||||
_parent.ClearCache(new JsonPayload(instance.Id, instance.Username));
|
||||
base.Remove(instance);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using Umbraco.Cms.Core.Sync;
|
||||
|
||||
namespace Umbraco.Cms.Core.Cache
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class for "typed" cache refreshers.
|
||||
/// </summary>
|
||||
/// <typeparam name="TInstanceType">The actual cache refresher type.</typeparam>
|
||||
/// <typeparam name="TEntityType">The entity type.</typeparam>
|
||||
/// <remarks>The actual cache refresher type is used for strongly typed events.</remarks>
|
||||
public abstract class TypedCacheRefresherBase<TInstanceType, TEntityType> : CacheRefresherBase<TInstanceType>, ICacheRefresher<TEntityType>
|
||||
where TInstanceType : class, ICacheRefresher
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TypedCacheRefresherBase{TInstanceType, TEntityType}"/>.
|
||||
/// </summary>
|
||||
/// <param name="appCaches">A cache helper.</param>
|
||||
protected TypedCacheRefresherBase(AppCaches appCaches)
|
||||
: base(appCaches)
|
||||
{ }
|
||||
|
||||
#region Refresher
|
||||
|
||||
public virtual void Refresh(TEntityType instance)
|
||||
{
|
||||
OnCacheUpdated(This, new CacheRefresherEventArgs(instance, MessageType.RefreshByInstance));
|
||||
}
|
||||
|
||||
public virtual void Remove(TEntityType instance)
|
||||
{
|
||||
OnCacheUpdated(This, new CacheRefresherEventArgs(instance, MessageType.RemoveByInstance));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user