gpt4 book ai didi

redis - Azure 在内存 (IMemoryCache) 或 Redis (IDistributedCache) 中使用哪种缓存模型

转载 作者:可可西里 更新时间:2023-11-01 11:15:52 25 4
gpt4 key购买 nike

希望我能得到一些关于哪种缓存机制最适合 Azure 的说明。

目前我的应用程序使用内存中 (IMemoryCache) 来保存经常访问的数据。

此功能是否与在单个 Web 服务器上一样?即存储在内存中一次并由每个请求访问?还是 Azure Web 服务器场使这变得复杂?

根据上述问题的答案,我是否更好地使用 Redis 和 IDistributedCache 模型?

最佳答案

下面是Memory缓存和DistributedCache缓存的区别。您可以根据自己的需要进行选择。

The benefit of using Memory cache is it is simple and fast. However you cannot scale your Web Apps if you are using in memory provider since it is not distributed.

Distributed In Memory Session State Provider such as Redis Cache Session State Your Web App can have a simple, fast, and scalable Session State Provider. Because this provider stores the Session state in a Cache, your app has to take in consideration all the characteristics associated when talking to a Distributed In Memory Cache, such as transient network failures.

For best practices on using Cache, see Caching guidance from Microsoft Patterns & Practices Azure Cloud Application Design and Implementation Guidance.

关于redis - Azure 在内存 (IMemoryCache) 或 Redis (IDistributedCache) 中使用哪种缓存模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48479499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com