using System;
namespace Umbraco.Cms.Core.Cache
{
///
/// Specifies how a repository cache policy should cache entities.
///
public class RepositoryCachePolicyOptions
{
///
/// Ctor - sets GetAllCacheValidateCount = true
///
public RepositoryCachePolicyOptions(Func performCount)
{
PerformCount = performCount;
GetAllCacheValidateCount = true;
GetAllCacheAllowZeroCount = false;
}
///
/// Ctor - sets GetAllCacheValidateCount = false
///
public RepositoryCachePolicyOptions()
{
PerformCount = null;
GetAllCacheValidateCount = false;
GetAllCacheAllowZeroCount = false;
}
///
/// Callback required to get count for GetAllCacheValidateCount
///
public Func PerformCount { get; set; }
///
/// True/false as to validate the total item count when all items are returned from cache, the default is true but this
/// means that a db lookup will occur - though that lookup will probably be significantly less expensive than the normal
/// GetAll method.
///
///
/// setting this to return false will improve performance of GetAll cache with no params but should only be used
/// for specific circumstances
///
public bool GetAllCacheValidateCount { get; set; }
///
/// True if the GetAll method will cache that there are zero results so that the db is not hit when there are no results found
///
public bool GetAllCacheAllowZeroCount { get; set; }
}
}