Differences between Microsoft.Extensions.Cashing.Redis and Microsoft.Extensions.Caching.StackExchangeRedis.RedisCache

徘徊边缘 提交于 2020-03-23 12:01:06

问题


I am a little bit lost. I am reading Microsoft documentation for ASP.NET Core chaching using Redis. And the documentation suggests to use Microsoft.Extensions.Cashing.StackExchangeRedis which is an open source third party library.

But I see some other tutorials are using Microsoft.Extensions.Cashing.Redis, which is a more native asp.net core.

And at the end they both use the same interface IDistributedCache

Why I need StackExchangeRedis and what advantages it has over Microsoft.Extensions.Cashing.Redis?


回答1:


A look at the dependency graph for Microsoft.Extensions.Caching.Redis and Microsoft.Extensions.Caching.StackExchangeRedis reveals it.

Microsoft.Extensions.Caching.Redis is based on StackExchange redis 1.x library, whereas Microsoft.Extensions.Caching.StackExchangeRedis is based on 2.x of the same library.

Also Microsoft.Extensions.Caching.Redis doesn't seem to target the 3.1 exteionsn libraries (Microsoft.Extensions.Options/Caching.Abstractions) where the other does.

So for .NET Core 3.x and newer use Microsoft.Extensions.Caching.StackExchangeRedis as the previous one may not be maintained as log as the new one.



来源:https://stackoverflow.com/questions/59847571/differences-between-microsoft-extensions-cashing-redis-and-microsoft-extensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!