You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using midiatR, we could easily archive something like this to simplify query cache.
publicclassCacheBehavior<TQuery,TResponse>:IPipelineBehavior<TQuery,TResponse>whereTQuery:ICachableQuerywhereTResponse:ICachableQueryResponse{publicasyncTask<TResponse>Handle(TQueryrequest,CancellationTokencancellationToken,RequestHandlerDelegate<TResponse>next){if(request.AllowCache==false){returnawaitnext();}varcacheResult=await_cacheService.Get<TResponse>(request.CacheKey);if(cacheResultis not null){returncacheResult;}varfreshResult=awaitnext();await_cacheService.Add<TResponse>(request.CacheKey,request.CacheTime);returnfreshResult;}}
The text was updated successfully, but these errors were encountered:
Using midiatR, we could easily archive something like this to simplify query cache.
The text was updated successfully, but these errors were encountered: