dotnetcore / EasyCaching

:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
MIT License
1.89k stars 322 forks source link

Cancellation token not used for Redis operations #535

Open oskrabanek opened 1 week ago

oskrabanek commented 1 week ago

Cancellation token is passed to the method but is not used while calling the Redis cache. In case of unavailable Redis instance the provider waits to fail on timeout even when the task is cancelled.

https://github.com/dotnetcore/EasyCaching/blob/c52c8f65591ece1e9821dcf77d28cc307bfa96b9/src/EasyCaching.CSRedis/DefaultCSRedisCachingProvider.Async.cs#L371

catcherwong commented 1 week ago

@oskrabanek Thanks for your interest in this project. We will take a look ASAP.

@Memoyu Could you spare a moment to look at the issue?

Memoyu commented 3 days ago

In fact, if we support passing in cancellationToken, we have already passed it in. Maybe csredis does not support passing in. https://github.com/2881099/csredis/blob/master/src/CSRedisCore/CSRedisClientAsync.cs#L2221
However, we seem to be able to refer to the involvement of csredis.IDistributedCache, but it doesn't seem to work. https://github.com/2881099/csredis/blob/master/src/Microsoft.Extensions.Caching.CSRedis/CSRedisCache.cs#L78