2016-01-07 16:31:20 +01:00
|
|
|
using Umbraco.Core.Models.EntityBase;
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Cache
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates cache policies
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="TEntity"></typeparam>
|
|
|
|
|
/// <typeparam name="TId"></typeparam>
|
|
|
|
|
internal class OnlySingleItemsRepositoryCachePolicyFactory<TEntity, TId> : IRepositoryCachePolicyFactory<TEntity, TId>
|
|
|
|
|
where TEntity : class, IAggregateRoot
|
|
|
|
|
{
|
|
|
|
|
private readonly IRuntimeCacheProvider _runtimeCache;
|
|
|
|
|
private readonly RepositoryCachePolicyOptions _options;
|
|
|
|
|
|
|
|
|
|
public OnlySingleItemsRepositoryCachePolicyFactory(IRuntimeCacheProvider runtimeCache, RepositoryCachePolicyOptions options)
|
|
|
|
|
{
|
|
|
|
|
_runtimeCache = runtimeCache;
|
|
|
|
|
_options = options;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual IRepositoryCachePolicy<TEntity, TId> CreatePolicy()
|
|
|
|
|
{
|
2016-01-07 17:54:55 +01:00
|
|
|
return new SingleItemsOnlyRepositoryCachePolicy<TEntity, TId>(_runtimeCache, _options);
|
2016-01-07 16:31:20 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|