Lesson 4 of 6 Application Architecture Solutions

Designing Caching with Azure Managed Redis

This lesson explains caching patterns and current Azure caching services.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the main caching patterns.
  • Choose an Azure Managed Redis tier.
  • Explain the status of Azure Cache for Redis.

Why cache

Reading from a database takes time and consumes capacity that could serve writes. If the same data is requested repeatedly, a fast in-memory copy can reduce latency from tens of milliseconds to around one millisecond, and it can allow a smaller database. Caching suits data that is read much more than it is written, such as product details, session state or the results of expensive queries. It does not suit data that must always be perfectly current, unless invalidation is carefully designed.

Caching patterns

The design of a cache concerns how data enters it and how it is kept fresh.

Cache-aside

In the cache-aside pattern, the application checks the cache first. On a miss, it reads from the database, then writes the result to the cache. This is the most common pattern, and only requested data is cached. The cache can hold stale data until an entry expires or is invalidated, so a time to live (TTL) is usually set.

Write-through and write-behind

With write-through caching, the application updates the cache and the database together, so the cache stays current at the cost of slower writes. With write-behind caching, writes go to the cache and are saved to the database later, which is fast but risks data loss if the cache fails before saving.

Content and session caching

A session store keeps user session state in a shared cache, so that web servers can remain stateless and scale freely. A content delivery network caches static files at the network edge, close to users, and it is covered with Azure Front Door in the network module.

Choosing a TTL involves a trade-off between freshness and load. A short TTL gives fresher data but sends more requests to the database. Applications must be able to continue if a cache is lost, since a cache should hold nothing that exists nowhere else.

The following diagram shows the two uses of one Azure Managed Redis cache for a web application.

Azure Managed Redis serving two purposes. With the cache-aside pattern, the 20 web instances read query results from the cache, kept for some minutes, and query the database only on a miss; and as a shared session store it keeps shopping carts when an instance restarts.
TTL stands for time to live.
Sort into groups

Name the caching pattern

Exam skills 4.2.4

Identify the caching pattern each description uses.

Log in to try this activity Interactive activities are free with an account.

Azure Managed Redis

Azure Managed Redis is Microsoft's recommended in-memory service, based on Redis Enterprise software, and supports Redis 7.4. Tiers are chosen according to the balance of memory to compute.

  • Memory Optimized has a high memory-to-vCPU ratio, 8:1, for large datasets with moderate throughput.
  • Balanced has a 4:1 ratio, for general use.
  • Compute Optimized has a 2:1 ratio, for the highest throughput.
  • Flash Optimized extends memory with NVMe storage, offering large capacity at a lower cost.

Azure Managed Redis supports active geo-replication, except on Flash Optimized and the smallest Balanced sizes, and this keeps caches in different regions synchronized, so that a global application can read and write locally. It also supports modules such as vector search, which suits AI workloads.

Match the pairs

Azure Managed Redis tiers

Exam skills 4.2.4

Match each Azure Managed Redis tier with its profile.

Log in to try this activity Interactive activities are free with an account.

Azure Cache for Redis status

Azure Cache for Redis is the older service, and it should not be chosen for a new design. Creating new Basic, Standard and Premium caches has been blocked for new customers since 1 April 2026, and all of these caches retire on 30 September 2028. Creation of new Enterprise and Enterprise Flash caches has also been blocked since 1 April 2026, and remaining caches will be migrated to Azure Managed Redis by 31 March 2027. Older study material may present Azure Cache for Redis as the standard answer, so be prepared to recommend Azure Managed Redis instead.

Other caching options

A dedicated cache is not always needed. Azure Cosmos DB integrated cache reduces RU cost for read-heavy workloads, through a dedicated gateway. Azure SQL read replicas can absorb read load, and in-memory columnstore indexes can accelerate analytics. In-process caching inside an application is the fastest of all, but each instance holds a separate copy, and the copies can diverge. Azure Front Door caches content at the edge, close to users.

The following table recaps which option fits which need.

NeedOption
Shared, low-latency application cacheAzure Managed Redis
Shared session state across web instancesAzure Managed Redis
Static content close to global usersAzure Front Door caching
Cheaper repeated reads from Cosmos DBCosmos DB integrated cache
Separating reports from a transactional SQL databaseRead scale-out
Scenario questions

Do we need Redis?

Exam skills 4.2.4

Choose the caching option that fits each need.

Log in to try this activity Interactive activities are free with an account.
Worked example

Caching a product catalogue

An online store's product pages each run several expensive database queries, and 95% of requests read data that changes only a few times a day. The web tier has 20 instances, and users lose their shopping carts when an instance restarts. The store is building a new deployment in Azure. What should you recommend?

Azure Managed Redis meets both needs. The cache-aside pattern stores query results, with a TTL of some minutes, which reduces database load. A shared session store solves the shopping cart problem, as session data no longer lives on individual instances.

Azure Cache for Redis would have been the older answer, but it is closed to new customers and retiring. An in-process cache would leave each of the 20 instances with a separate copy, and would not address session state. A larger database would raise cost without solving the session problem.

Check yourself

Which service should a new design use instead of Azure Cache for Redis?

Show answer

Azure Managed Redis. Azure Cache for Redis is closed to new customers and retiring.

Exam Tips

Remember for the exam

  • Cache-aside is the usual pattern: check, then read, then populate.
  • Recommend Azure Managed Redis; Azure Cache for Redis is closed to new customers and retiring.
  • Tiers: Memory Optimized, Balanced, Compute Optimized and Flash Optimized.
  • A shared cache lets web tiers stay stateless.