Add IContextCache to deploy connectors (#13287)

* Add IContextCache and implementations

* Update connector interfaces to use IContextCache

* Minor cleanup

* Move DeployContextCache prefix to constant

* Move default implementations to obsolete methods

* Remove DeployContextCache and DictionaryCache

Co-authored-by: Andy Butland <abutland73@gmail.com>
This commit is contained in:
Ronald Barendse
2022-10-25 18:40:11 +02:00
committed by GitHub
parent fc187596e3
commit 1560e84f14
10 changed files with 359 additions and 157 deletions

View File

@@ -0,0 +1,34 @@
namespace Umbraco.Cms.Core.Deploy;
/// <summary>
/// A pass through context cache that always creates the items.
/// </summary>
/// <seealso cref="Umbraco.Cms.Core.Deploy.IContextCache" />
public sealed class PassThroughCache : IContextCache
{
/// <summary>
/// Gets the instance.
/// </summary>
/// <value>
/// The instance.
/// </value>
public static PassThroughCache Instance { get; } = new PassThroughCache();
/// <summary>
/// Prevents a default instance of the <see cref="PassThroughCache"/> class from being created.
/// </summary>
private PassThroughCache()
{ }
/// <inheritdoc />
public void Create<T>(string key, T item)
{ }
/// <inheritdoc />
public T? GetOrCreate<T>(string key, Func<T?> factory)
=> factory();
/// <inheritdoc />
public void Clear()
{ }
}