Interface IAppPolicyCache
Defines an application cache that support cache policies.
Namespace: Umbraco.Cms.Core.Cache
Assembly: Umbraco.Core.dll
Syntax
public interface IAppPolicyCache : IAppCache
Remarks
A cache policy can be used to cache with timeouts, or depending on files, and with a remove callback, etc.
Methods
View SourceGet(string, Func<object?>, TimeSpan?, bool)
Gets an item identified by its key.
Declaration
object? Get(string key, Func<object?> factory, TimeSpan? timeout, bool isSliding = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key of the item. |
| Func<object> | factory | A factory function that can create the item. |
| TimeSpan? | timeout | An optional cache timeout. |
| bool | isSliding | An optional value indicating whether the cache timeout is sliding (default is false). |
Returns
| Type | Description |
|---|---|
| object | The item. |
Insert(string, Func<object?>, TimeSpan?, bool)
Inserts an item.
Declaration
void Insert(string key, Func<object?> factory, TimeSpan? timeout = null, bool isSliding = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The key of the item. |
| Func<object> | factory | A factory function that can create the item. |
| TimeSpan? | timeout | An optional cache timeout. |
| bool | isSliding | An optional value indicating whether the cache timeout is sliding (default is false). |