2022-01-13 17:44:11 +00:00
|
|
|
// Copyright (c) Umbraco.
|
2021-02-12 10:13:56 +01:00
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.Models.Entities;
|
2021-02-15 11:41:12 +01:00
|
|
|
using Umbraco.Cms.Core.Scoping;
|
2022-01-13 17:44:11 +00:00
|
|
|
using Umbraco.Cms.Infrastructure.Scoping;
|
2016-01-07 16:31:20 +01:00
|
|
|
|
2021-02-12 10:13:56 +01:00
|
|
|
namespace Umbraco.Cms.Core.Cache
|
2016-01-07 16:31:20 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2016-06-01 10:35:44 +02:00
|
|
|
/// Represents a special policy that does not cache the result of GetAll.
|
2016-01-07 16:31:20 +01:00
|
|
|
/// </summary>
|
2016-06-01 10:35:44 +02:00
|
|
|
/// <typeparam name="TEntity">The type of the entity.</typeparam>
|
|
|
|
|
/// <typeparam name="TId">The type of the identifier.</typeparam>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// <para>Overrides the default repository cache policy and does not writes the result of GetAll
|
|
|
|
|
/// to cache, but only the result of individual Gets. It does read the cache for GetAll, though.</para>
|
|
|
|
|
/// <para>Used by DictionaryRepository.</para>
|
|
|
|
|
/// </remarks>
|
2016-01-07 17:54:55 +01:00
|
|
|
internal class SingleItemsOnlyRepositoryCachePolicy<TEntity, TId> : DefaultRepositoryCachePolicy<TEntity, TId>
|
2018-01-10 12:48:51 +01:00
|
|
|
where TEntity : class, IEntity
|
2016-01-07 16:31:20 +01:00
|
|
|
{
|
2019-01-18 07:56:38 +01:00
|
|
|
public SingleItemsOnlyRepositoryCachePolicy(IAppPolicyCache cache, IScopeAccessor scopeAccessor, RepositoryCachePolicyOptions options)
|
2017-12-15 16:29:14 +01:00
|
|
|
: base(cache, scopeAccessor, options)
|
2016-06-01 10:35:44 +02:00
|
|
|
{ }
|
|
|
|
|
|
2022-02-24 10:22:20 +01:00
|
|
|
protected override void InsertEntities(TId[]? ids, TEntity[]? entities)
|
2016-01-07 16:31:20 +01:00
|
|
|
{
|
2016-06-01 10:35:44 +02:00
|
|
|
// nop
|
2016-01-07 16:31:20 +01:00
|
|
|
}
|
|
|
|
|
}
|
2017-07-20 11:21:28 +02:00
|
|
|
}
|