using System; using Umbraco.Core.Serialization; using Umbraco.Core.Sync; namespace Umbraco.Core.Cache { /// /// A base class for "payload" class refreshers. /// /// The actual cache refresher type. /// The payload type. /// The actual cache refresher type is used for strongly typed events. public abstract class PayloadCacheRefresherBase : JsonCacheRefresherBase, IPayloadCacheRefresher where TInstanceType : class, ICacheRefresher { /// /// Initializes a new instance of the . /// /// A cache helper. /// protected PayloadCacheRefresherBase(AppCaches appCaches, IJsonSerializer serializer) : base(appCaches, serializer) { } #region Refresher public override void Refresh(string json) { var payload = Deserialize(json); Refresh(payload); } /// /// Refreshes as specified by a payload. /// /// The payload. public virtual void Refresh(TPayload[] payloads) { OnCacheUpdated(This, new CacheRefresherEventArgs(payloads, MessageType.RefreshByPayload)); } #endregion } }