<PackageReference Include="Polly" Version="7.2.1" />

AsyncCacheEngine

static class AsyncCacheEngine
using System; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; namespace Polly.Caching { internal static class AsyncCacheEngine { [AsyncStateMachine(typeof(<ImplementationAsync>d__0<>))] internal static Task<TResult> ImplementationAsync<TResult>(IAsyncCacheProvider<TResult> cacheProvider, ITtlStrategy<TResult> ttlStrategy, Func<Context, string> cacheKeyStrategy, Func<Context, CancellationToken, Task<TResult>> action, Context context, CancellationToken cancellationToken, bool continueOnCapturedContext, Action<Context, string> onCacheGet, Action<Context, string> onCacheMiss, Action<Context, string> onCachePut, Action<Context, string, Exception> onCacheGetError, Action<Context, string, Exception> onCachePutError) { <ImplementationAsync>d__0<TResult> stateMachine = default(<ImplementationAsync>d__0<TResult>); stateMachine.cacheProvider = cacheProvider; stateMachine.ttlStrategy = ttlStrategy; stateMachine.cacheKeyStrategy = cacheKeyStrategy; stateMachine.action = action; stateMachine.context = context; stateMachine.cancellationToken = cancellationToken; stateMachine.continueOnCapturedContext = continueOnCapturedContext; stateMachine.onCacheGet = onCacheGet; stateMachine.onCacheMiss = onCacheMiss; stateMachine.onCachePut = onCachePut; stateMachine.onCacheGetError = onCacheGetError; stateMachine.onCachePutError = onCachePutError; stateMachine.<>t__builder = AsyncTaskMethodBuilder<TResult>.Create(); stateMachine.<>1__state = -1; AsyncTaskMethodBuilder<TResult> <>t__builder = stateMachine.<>t__builder; <>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } } }