Skip to content

Pact Cache DistributedCacheBase GetOrCreateAsync T (string System Func Microsoft Extensions Caching Distributed DistributedCacheEntryOptions System Threading Tasks Task T System Text Json JsonSerializerOptions)

welshronaldo edited this page May 30, 2022 · 4 revisions

DistributedCacheBase.GetOrCreateAsync<T>(string, Func<DistributedCacheEntryOptions,Task<T>>, JsonSerializerOptions) Method

Retrieves or creates a reference type in json format against the specified key

public System.Threading.Tasks.Task<T> GetOrCreateAsync<T>(string key, System.Func<Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions,System.Threading.Tasks.Task<T>> factory, System.Text.Json.JsonSerializerOptions jsonOptions=null)
    where T : class;

Type parameters

T

Parameters

key System.String

factory System.Func<Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions,System.Threading.Tasks.Task<T>>

jsonOptions System.Text.Json.JsonSerializerOptions
Optional options to override the default STJ ones

Returns

System.Threading.Tasks.Task<T>

Implements GetOrCreateAsync(string, Func<DistributedCacheEntryOptions,Task>, JsonSerializerOptions)

Remarks

Internally (de)serializes (from)/to JSON

Clone this wiki locally