Files
Umbraco-CMS/src/Umbraco.Core/Cache/IAppPolicyCache.cs
2019-01-21 16:01:37 +01:00

53 lines
2.4 KiB
C#

using System;
using System.Web.Caching;
namespace Umbraco.Core.Cache
{
/// <summary>
/// Defines an application cache that support cache policies.
/// </summary>
/// <remarks>A cache policy can be used to cache with timeouts,
/// or depending on files, and with a remove callback, etc.</remarks>
public interface IAppPolicyCache : IAppCache
{
/// <summary>
/// Gets an item identified by its key.
/// </summary>
/// <param name="key">The key of the item.</param>
/// <param name="factory">A factory function that can create the item.</param>
/// <param name="timeout">An optional cache timeout.</param>
/// <param name="isSliding">An optional value indicating whether the cache timeout is sliding (default is false).</param>
/// <param name="priority">An optional cache priority (default is Normal).</param>
/// <param name="removedCallback">An optional callback to handle removals.</param>
/// <param name="dependentFiles">Files the cache entry depends on.</param>
/// <returns>The item.</returns>
object Get(
string key,
Func<object> factory,
TimeSpan? timeout,
bool isSliding = false,
CacheItemPriority priority = CacheItemPriority.Normal,
CacheItemRemovedCallback removedCallback = null,
string[] dependentFiles = null);
/// <summary>
/// Inserts an item.
/// </summary>
/// <param name="key">The key of the item.</param>
/// <param name="factory">A factory function that can create the item.</param>
/// <param name="timeout">An optional cache timeout.</param>
/// <param name="isSliding">An optional value indicating whether the cache timeout is sliding (default is false).</param>
/// <param name="priority">An optional cache priority (default is Normal).</param>
/// <param name="removedCallback">An optional callback to handle removals.</param>
/// <param name="dependentFiles">Files the cache entry depends on.</param>
void Insert(
string key,
Func<object> factory,
TimeSpan? timeout = null,
bool isSliding = false,
CacheItemPriority priority = CacheItemPriority.Normal,
CacheItemRemovedCallback removedCallback = null,
string[] dependentFiles = null);
}
}