using System; using System.Collections.Generic; using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Scoping; namespace Umbraco.Core.Cache { /// /// A base class for repository cache policies. /// /// The type of the entity. /// The type of the identifier. internal abstract class RepositoryCachePolicyBase : IRepositoryCachePolicy where TEntity : class, IAggregateRoot { protected RepositoryCachePolicyBase(IRuntimeCacheProvider cache) { Cache = cache ?? throw new ArgumentNullException(nameof(cache)); } public abstract IRepositoryCachePolicy Scoped(IRuntimeCacheProvider runtimeCache, IScope scope); protected IRuntimeCacheProvider Cache { get; } /// public abstract TEntity Get(TId id, Func performGet, Func> performGetAll); /// public abstract TEntity GetCached(TId id); /// public abstract bool Exists(TId id, Func performExists, Func> performGetAll); /// public abstract void Create(TEntity entity, Action persistNew); /// public abstract void Update(TEntity entity, Action persistUpdated); /// public abstract void Delete(TEntity entity, Action persistDeleted); /// public abstract TEntity[] GetAll(TId[] ids, Func> performGetAll); /// public abstract void ClearAll(); } }