Files
Umbraco-CMS/src/Umbraco.Core/Cache/RepositoryCachePolicyOptions.cs
Mole bf41c2eeaa Netcore: Align namespaces (#9801)
* Rename Umbraco.Core namespace to Umbraco.Cms.Core

* Move extension methods in core project to Umbraco.Extensions

* Move extension methods in core project to Umbraco.Extensions

* Rename Umbraco.Examine namespace to Umbraco.Cms.Examine

* Move examine extensions to Umbraco.Extensions namespace

* Reflect changed namespaces in Builder and fix unit tests

* Adjust namespace in Umbraco.ModelsBuilder.Embedded

* Adjust namespace in Umbraco.Persistence.SqlCe

* Adjust namespace in Umbraco.PublishedCache.NuCache

* Align namespaces in Umbraco.Web.BackOffice

* Align namespaces in Umbraco.Web.Common

* Ensure that SqlCeSupport is still enabled after changing the namespace

* Align namespaces in Umbraco.Web.Website

* Align namespaces in Umbraco.Web.UI.NetCore

* Align namespaces in Umbraco.Tests.Common

* Align namespaces in Umbraco.Tests.UnitTests

* Align namespaces in Umbraco.Tests.Integration

* Fix errors caused by changed namespaces

* Fix integration tests

* Undo the Umbraco.Examine.Lucene namespace change

This breaks integration tests on linux, since the namespace wont exists there because it's only used on windows.

* Fix merge

* Fix Merge
2021-02-18 11:06:02 +01:00

52 lines
1.8 KiB
C#

using System;
namespace Umbraco.Cms.Core.Cache
{
/// <summary>
/// Specifies how a repository cache policy should cache entities.
/// </summary>
public class RepositoryCachePolicyOptions
{
/// <summary>
/// Ctor - sets GetAllCacheValidateCount = true
/// </summary>
public RepositoryCachePolicyOptions(Func<int> performCount)
{
PerformCount = performCount;
GetAllCacheValidateCount = true;
GetAllCacheAllowZeroCount = false;
}
/// <summary>
/// Ctor - sets GetAllCacheValidateCount = false
/// </summary>
public RepositoryCachePolicyOptions()
{
PerformCount = null;
GetAllCacheValidateCount = false;
GetAllCacheAllowZeroCount = false;
}
/// <summary>
/// Callback required to get count for GetAllCacheValidateCount
/// </summary>
public Func<int> PerformCount { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <remarks>
/// setting this to return false will improve performance of GetAll cache with no params but should only be used
/// for specific circumstances
/// </remarks>
public bool GetAllCacheValidateCount { get; set; }
/// <summary>
/// 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
/// </summary>
public bool GetAllCacheAllowZeroCount { get; set; }
}
}