I run a .NET Core
application running on 5 Azure App Service
instances.
I am going to migrate my configuration to Azure App Configuration
, where the SDK (NuGet package) caches the values in-memory for a specified time (i.e. 30 minutes).
Considering the life-cycle of an instance, is this in-memory caching recommended over caching the values in Azure Cache for Redis
?
2
Answers
Azure Cache for Redis
in theAzure Portal
.Using App Configuration values in Azure Cache for Redis is simple and can increase the performance of the Azure App.
In
.NET Application
install theMicrosoft.Extensions.Caching.StackExchangeRedis
NuGet Package.Code reference taken from App Configuration
Thanks @Jaydeep Patil for the explanation.
If your application has only one instance, then using In-memory cache is a better option.
Thanks @Krunal Trivedi for a Step-by-Step Demo.
As you have mentioned caches the values for a specified time (30 min), then using
In-memory
cache is advised.At a high level, both Azure App Configuration and Azure Cache for Redis are key-value storage, but they are tailored and optimized for different scenarios. You may evaluate based on your need.
Azure App Configuration is for configuration scenarios. Here are a few things it offers:
Azure Cache for Redis is for distributed caching scenarios. You have your dedicated deployment. Your data may be changed frequently, but you don’t really care about the history of changes.