Skip to content

Pact Cache IDistributedCacheService SetAsync 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

IDistributedCacheService.SetAsync<T>(string, Func<DistributedCacheEntryOptions,Task<T>>, JsonSerializerOptions) Method

Convert a reference type to a json string and store it against the specified key

System.Threading.Tasks.Task<T> SetAsync<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>

Remarks

Internally serializes to JSON

Clone this wiki locally