Exemple #1
0
 public async Task <IWebApiResponse> OnRequestAsync(MiddlewareContext context, Func <MiddlewareContext, CancellationToken, Task <IWebApiResponse> > callNext, CancellationToken cancellationToken = new CancellationToken())
 {
     return(await _bucket.ConsumeCompliant(() => callNext(context, cancellationToken)).ConfigureAwait(false));
 }
 return(await _cache.GetOrUpdateAsync <T>(category, id, async() => await _bucket.ConsumeCompliant(updateFunc)).ConfigureAwait(false));