2016-01-27 19:44:36 +01:00
|
|
|
using System;
|
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 FullDataSetRepositoryCachePolicyFactory<TEntity, TId> : IRepositoryCachePolicyFactory<TEntity, TId>
|
|
|
|
|
where TEntity : class, IAggregateRoot
|
|
|
|
|
{
|
|
|
|
|
private readonly IRuntimeCacheProvider _runtimeCache;
|
2016-01-27 19:44:36 +01:00
|
|
|
private readonly Func<TEntity, TId> _getEntityId;
|
|
|
|
|
|
|
|
|
|
public FullDataSetRepositoryCachePolicyFactory(IRuntimeCacheProvider runtimeCache, Func<TEntity, TId> getEntityId)
|
2016-01-07 16:31:20 +01:00
|
|
|
{
|
2016-01-27 19:44:36 +01:00
|
|
|
_runtimeCache = runtimeCache;
|
|
|
|
|
_getEntityId = getEntityId;
|
2016-01-07 16:31:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual IRepositoryCachePolicy<TEntity, TId> CreatePolicy()
|
|
|
|
|
{
|
2016-01-27 19:44:36 +01:00
|
|
|
return new FullDataSetRepositoryCachePolicy<TEntity, TId>(_runtimeCache, _getEntityId);
|
2016-01-07 16:31:20 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|