CacheExtensions.GetOrCreateAsync<TItem> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
generic <typename TItem>
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<TItem> ^ GetOrCreateAsync(Microsoft::Extensions::Caching::Memory::IMemoryCache ^ cache, System::Object ^ key, Func<Microsoft::Extensions::Caching::Memory::ICacheEntry ^, System::Threading::Tasks::Task<TItem> ^> ^ factory);
public static System.Threading.Tasks.Task<TItem> GetOrCreateAsync<TItem> (this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key, Func<Microsoft.Extensions.Caching.Memory.ICacheEntry,System.Threading.Tasks.Task<TItem>> factory);
public static System.Threading.Tasks.Task<TItem?> GetOrCreateAsync<TItem> (this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key, Func<Microsoft.Extensions.Caching.Memory.ICacheEntry,System.Threading.Tasks.Task<TItem>> factory);
static member GetOrCreateAsync : Microsoft.Extensions.Caching.Memory.IMemoryCache * obj * Func<Microsoft.Extensions.Caching.Memory.ICacheEntry, System.Threading.Tasks.Task<'Item>> -> System.Threading.Tasks.Task<'Item>
<Extension()>
Public Function GetOrCreateAsync(Of TItem) (cache As IMemoryCache, key As Object, factory As Func(Of ICacheEntry, Task(Of TItem))) As Task(Of TItem)
Type Parameters
- TItem
Parameters
- cache
- IMemoryCache
- key
- Object
- factory
- Func<ICacheEntry,Task<TItem>>
Returns
- Task<TItem>