using System; using System.Collections.Generic; using System.Linq; using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Scoping; namespace Umbraco.Core.Cache { internal class NoCacheRepositoryCachePolicy : IRepositoryCachePolicy where TEntity : class, IEntity { private NoCacheRepositoryCachePolicy() { } public static NoCacheRepositoryCachePolicy Instance { get; } = new NoCacheRepositoryCachePolicy(); public IRepositoryCachePolicy Scoped(IRuntimeCacheProvider runtimeCache, IScope scope) { throw new NotImplementedException(); } public TEntity Get(TId id, Func performGet, Func> performGetAll) { return performGet(id); } public TEntity GetCached(TId id) { return null; } public bool Exists(TId id, Func performExists, Func> performGetAll) { return performExists(id); } public void Create(TEntity entity, Action persistNew) { persistNew(entity); } public void Update(TEntity entity, Action persistUpdated) { persistUpdated(entity); } public void Delete(TEntity entity, Action persistDeleted) { persistDeleted(entity); } public TEntity[] GetAll(TId[] ids, Func> performGetAll) { return performGetAll(ids).ToArray(); } public void ClearAll() { } } }