Interface IContextCache
Represents a context cache used by Deploy operations.
Namespace: Umbraco.Cms.Core.Deploy
Assembly: Umbraco.Core.dll
Syntax
public interface IContextCache
Methods
View SourceClear()
Clears all cached items on this context.
Declaration
void Clear()
Create<T>(String, T)
Creates the item on the context cache using the specified key
.
Declaration
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
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
virtual 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. |