Consider writing an analyzer that produces warnings when using sync APIs on IDistributedCache
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
`IDistributedCache` has a few synchronous APIs
* https://docs.microsoft.com/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache.get?#Microsoft_Extensions_Caching_Distributed_IDistributedCache_Get_System_String_
* https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache.refresh
* https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache.remove
* https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache.set
In the SqlServer and RedisCache implementations this ends up making blocking calls: e.g. https://github.com/dotnet/aspnetcore/blob/main/src/Caching/SqlServer/src/DatabaseOperations.cs#L54-L62. The proposal is to add an analyzer that warns against the use of these APIs.
Contributor guide
Assessment
This issue has not been assessed yet.