Closed arslanaybars closed 1 year ago
@arslanaybars Have you read our docs on async? https://github.com/castleproject/Core/blob/master/docs/dynamicproxy-async-interception.md
You can definitely call GetAsync
in Intercept, you just can't await it. You'll have to set up your own continuation, which can be done using the await C# keyword using one of the library listed at the bottom of the docs.
I developed a package that helps us with aspect-oriented caching which name is AybCache I used castle core for the intercepting.
This package basically check data from the cache if it exists return from the cache, if it is not exist run the method and write the result to the cache using
IDistributedCache
But I need to check data with sync way because I could not call the async method with await in void intercept method. which is below
var data = _distributedCache.Get(cacheKey);
click to see in repositoryBut under high load, my Redis synctimeout could not be enough and need to increase synctimeout which I don't want.
Is there any way to call
_distributedCache.GetAsync(cacheKey)
method instead of_distributedCache.Get(cacheKey);
in the intercept methodPull requests are welcome.