Class PassThroughCache
A pass through context cache that always creates the items.
Inheritance
Namespace: Umbraco.Cms.Core.Deploy
Assembly: Umbraco.Core.dll
Syntax
public sealed class PassThroughCache : IContextCache
Properties
View SourceInstance
Gets the instance.
Declaration
public static PassThroughCache Instance { get; }
Property Value
Type | Description |
---|---|
PassThroughCache | The instance. |
Methods
View SourceClear()
Clears all cached items on this context.
Declaration
public void Clear()
Create<T>(String, T)
Creates the item on the context cache using the specified key
.
Declaration
public void Create<T>(string key, T item)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the cached item. |
T | item | The item. |
Type Parameters
Name | Description |
---|---|
T | The type of the cached item. |
GetOrCreate<T>(String, Func<T>)
Gets an item from the context cache or creates and stores it using the specified key
.
Declaration
public T GetOrCreate<T>(string key, Func<T> factory)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the cached item. |
Func<T> | factory | The factory method to create the item (if it doesn't exist yet). |
Returns
Type | Description |
---|---|
T | The item. |
Type Parameters
Name | Description |
---|---|
T | The type of the cached item. |
GetOrCreateAsync<T>(String, Func<Task<T>>)
Gets an item from the context cache or creates and stores it using the specified key
.
Declaration
public async Task<T> GetOrCreateAsync<T>(string key, Func<Task<T>> factory)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key of the cached item. |
Func<Task<T>> | factory | The factory method to create the item (if it doesn't exist yet). |
Returns
Type | Description |
---|---|
Task<T> | A task that represents the asynchronous operation. The task result contains the item. |
Type Parameters
Name | Description |
---|---|
T | The type of the cached item. |