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

标签 redis azure-web-app-service azure-caching

希望我能得到一些关于哪种缓存机制最适合 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/

相关文章:

javascript - 使用 Azure 发布静态网站

azure - 如何清除 WebRole 启动时的整个 Windows Azure Appfabric 缓存?

azure - 在 Windows Azure 共享缓存中,无法在美国东部或美国西部区域启动缓存 - 为什么?

redis - Infinispan 是否支持像 Redis 这样的结构化值的原生操作?

php - Redis可用性检查

python - 向所有 worker 广播任务 : redis+celery

amazon-web-services - 在 AWS ElastiCache Redis 集群上启用集群模式

azure - 创建应用服务托管证书显示成功,但证书未出现

azure - Windows azure 部署问题,仅部署新的/更新的内容

c# - 在c#中使用redis缓存时任务取消错误