AZ-900Chapter 94 of 127Objective 2.4

Azure Cache for Redis

This chapter covers Azure Cache for Redis, a fully managed in-memory caching service that accelerates data access and reduces database load. For the AZ-900 exam, this falls under Domain 2: Azure Architecture and Services, Objective 2.4: Describe Azure database and analytics services. While caching itself is a small part of the exam, understanding Azure Cache for Redis helps you answer questions about performance optimization and data storage options. This topic typically appears in 1-2 questions, often comparing it to other Azure data services like Azure Cosmos DB or SQL Database.

25 min read
Intermediate
Updated May 31, 2026

The Speed-Dial Waitress

Imagine a busy diner where customers frequently order the same popular dishes: coffee, pancakes, club sandwiches. The kitchen (the main database) is in the back and takes time to prepare each order from scratch. To speed things up, the head waitress keeps a small, fast-access notepad at the counter. When a customer orders coffee, she first checks her notepad. If she already has a freshly brewed pot noted (and it's still hot), she pours it immediately—no need to go back to the kitchen. If the notepad doesn't have it, she calls the kitchen, waits for the coffee, serves it, and then writes down the new pot on her notepad for the next request. The notepad is small—she can only remember a few items—so she uses a 'least recently used' rule: if the notepad is full and she needs to add a new dish, she erases the dish that hasn't been ordered in the longest time. This notepad is Azure Cache for Redis: an in-memory data store that holds frequently accessed data (like session states, product catalogs, or database query results) to serve requests at blazing speeds, reducing load on the backend database and improving application responsiveness. The 'notepad' is stored in RAM (not on disk), making it extremely fast, but volatile—if the waitress leaves (server restarts), the notepad is wiped clean. Azure Cache for Redis manages this notepad for you, handling replication, failover, and scaling so you don't have to worry about the waitress forgetting the orders.

How It Actually Works

What is Azure Cache for Redis and What Business Problem Does It Solve?

Azure Cache for Redis is a fully managed, in-memory caching service based on the open-source Redis (Remote Dictionary Server) engine. It provides a high-performance, low-latency data store that keeps data in memory (RAM) rather than on disk, enabling sub-millisecond read and write operations. The primary business problem it solves is the latency and throughput bottleneck caused by repeatedly fetching the same data from a slower backend database or external API. In many applications, a small percentage of data (e.g., product catalog, user sessions, configuration settings) is accessed frequently. Without a cache, every request hits the database, increasing response times and database load, leading to higher costs and poor user experience. Azure Cache for Redis alleviates this by storing frequently accessed data in memory, so subsequent requests can be served instantly without touching the database. It also enables use cases like session management, real-time leaderboards, message brokering, and distributed locking.

How It Works: The Caching Mechanism Step by Step

Azure Cache for Redis operates as a key-value store. Data is stored as a key (a string) and a value (which can be a string, hash, list, set, sorted set, or other data structures). When an application needs data, it first checks the Redis cache. If the data exists (a cache hit), it is returned immediately. If not (a cache miss), the application fetches the data from the primary database, stores it in the cache for future requests, and then returns it. This pattern is called 'lazy loading' or 'cache-aside'. The application is responsible for managing cache invalidation—updating or removing cached data when the underlying data changes. Azure Cache for Redis does not automatically synchronize with the database; it is a passive cache. To keep the cache fresh, developers often set a time-to-live (TTL) on cached items, after which the item expires and is automatically removed. Redis uses an eviction policy (like Least Recently Used – LRU) when memory is full, to make room for new items.

Key Components, Tiers, and Pricing Models

Azure Cache for Redis offers several tiers:

Basic Tier: Single node, no SLA, up to 53 GB memory. Ideal for development/testing. No replication.

Standard Tier: Two-node replicated configuration (primary/replica) with a 99.9% SLA. Up to 120 GB memory. Replica is read-only and provides automatic failover.

Premium Tier: High-performance with additional features like data persistence (RDB/AOF), clustering (automatic sharding across multiple nodes), and Virtual Network support. SLA 99.9% with clustering, 99.95% for standard premium. Memory up to 1.2 TB with clustering.

Enterprise and Enterprise Flash Tiers: Based on Redis Enterprise, offering 99.99% SLA, active geo-replication, and Flash-optimized tier for large datasets at lower cost. These are newer additions for high-demand scenarios.

Pricing is based on tier, memory size (GB), and data transfer. The Basic tier is cheapest but has no SLA. Standard is most common for production. Premium adds cost for clustering, persistence, and VNet. Enterprise is the most expensive.

How It Compares to On-Premises Equivalent

On-premises, you would deploy a Redis server (open-source) on a VM or bare metal. You'd manage installation, configuration, patching, backups, monitoring, scaling, and failover manually. Azure Cache for Redis abstracts all that: you provision a cache instance via the portal, CLI, or ARM template, and Azure handles the underlying infrastructure, patching, replication, and failover (in Standard and above). On-premises, you have full control but higher operational overhead. Azure Cache for Redis also integrates natively with Azure services like App Service, Functions, and Azure SQL, making it easier to adopt in cloud-native architectures. The trade-off is that you cannot modify the Redis configuration file (redis.conf) directly—you can only configure a subset of parameters via Azure's management interface.

Azure Portal and CLI Touchpoints

In the Azure portal, you can create a cache instance by searching for 'Azure Cache for Redis' and clicking 'Create'. You specify DNS name, subscription, resource group, location, tier, and memory size. After deployment, you get a hostname (e.g., mycache.redis.cache.windows.net) and access keys. You can configure advanced settings like clustering, persistence, and firewall rules. The portal provides monitoring metrics (hits, misses, evictions, CPU, memory) and a console to run Redis commands.

Using the Azure CLI, you can create a cache with:

az redis create \
  --resource-group myResourceGroup \
  --name myCache \
  --location eastus \
  --sku Standard \
  --vm-size C0

To list access keys:

az redis list-keys --resource-group myResourceGroup --name myCache

For Bicep/ARM templates, you define a Microsoft.Cache/Redis resource with properties like sku (name, family, capacity) and enableNonSslPort.

Concrete Business Scenarios

Consider an e-commerce website with a product catalog stored in Azure SQL Database. Without caching, every page load queries the database, causing high latency and database load during peak shopping seasons. By adding Azure Cache for Redis, the product details (name, price, image URL) are cached with a TTL of 5 minutes. Cache hit rates exceed 90%, reducing database queries by 90% and page load times from 500ms to 10ms. Another scenario: a gaming platform needs real-time leaderboards. Redis sorted sets allow efficient ranking updates and retrieval. A third scenario: a microservices application uses Redis as a message broker with Pub/Sub patterns to decouple services.

Walk-Through

1

Provision the Cache Instance

In the Azure portal, search for 'Azure Cache for Redis' and click 'Create'. You must select a subscription, resource group, and region. Choose a DNS name (must be globally unique within `redis.cache.windows.net`). Then select a tier: Basic for dev/test, Standard for production with replication, Premium for high-performance. For Standard, you choose a cache size (e.g., C0 – 250MB, C1 – 1GB, etc.). You can also enable non-SSL port (port 6379) for legacy clients, but SSL (port 6380) is recommended. After creation, Azure deploys the cache, which takes a few minutes. Behind the scenes, Azure provisions VMs with Redis installed, configures networking, and sets up replication if Standard tier.

2

Configure Access and Networking

After deployment, go to the 'Access keys' blade to get the primary and secondary keys. These are used to authenticate connections. You can regenerate keys if compromised. In the 'Firewall' blade, you can add IP address ranges that are allowed to connect. For production, restrict access to specific Azure services or your app's public IP. For higher security, use Azure Private Link (Premium tier) to connect privately from a virtual network. Also, ensure your application uses the SSL port (6380) with the access key. Redis does not support authentication without a password (key) by default; the key acts as the password.

3

Connect Your Application

You need a Redis client library for your programming language (e.g., StackExchange.Redis for .NET, redis-py for Python). The connection string format is: `mycache.redis.cache.windows.net:6380,password=yourkey,ssl=True`. Your application initializes a connection multiplexer (a single, reusable connection) to the cache. For example, in .NET: `var connection = ConnectionMultiplexer.Connect("mycache.redis.cache.windows.net:6380,password=abc...");`. The multiplexer handles connection pooling and retry logic. Once connected, you can use the `IDatabase` interface to perform operations like `StringSet` and `StringGet`.

4

Implement Caching Logic

Implement the cache-aside pattern: Before fetching data from the database, check the cache. If the key exists (cache hit), return the cached value. If not (cache miss), query the database, store the result in the cache with a TTL, and return the value. For example, in C#: `string cachedData = db.StringGet("product:123"); if (cachedData == null) { cachedData = GetFromDatabase(123); db.StringSet("product:123", cachedData, TimeSpan.FromMinutes(5)); } return cachedData;`. Set an appropriate TTL based on how often the underlying data changes. Too short TTL reduces cache effectiveness; too long risks serving stale data. Also implement cache invalidation: when data is updated, delete or update the corresponding cache entry.

5

Monitor and Scale

Use Azure Monitor metrics to track cache performance: Cache Hit Ratio (target >80%), Cache Misses, Evictions (indicates memory pressure), CPU, and Memory Usage. If the hit ratio is low or evictions are high, you may need to increase the cache size or adjust TTLs. In the portal, you can scale up (increase memory) or scale out (add clustering in Premium). Scaling is a live operation with minimal downtime. For Standard tier, scaling up changes the VM size. For Premium, you can enable clustering to shard data across multiple nodes, increasing total memory and throughput. Also set alerts for high CPU or evictions to proactively manage capacity.

What This Looks Like on the Job

Scenario 1: E-commerce Product Catalog Caching

A large online retailer uses Azure SQL Database to store product details (name, price, description, images). During Black Friday, traffic spikes to 100,000 requests per second. Without caching, each product page load queries the database, resulting in high latency (average 800ms) and database CPU at 95%, causing timeouts. The team deploys Azure Cache for Redis Standard tier (C6 – 53GB) in the same region as the app. They implement cache-aside with a TTL of 5 minutes for product details. Cache hit ratio reaches 95%, reducing database queries by 95%. Page load times drop to 50ms, and database CPU falls to 30%. The cache costs approximately $500/month, but the savings in database scaling and improved user experience justify the expense. They also configure eviction policy to 'allkeys-lru' to handle memory pressure gracefully.

Scenario 2: Session State for Web Applications

A Software-as-a-Service (SaaS) company runs a multi-tenant web application on Azure App Service. User session data (e.g., shopping cart, login status) is stored in-memory on the web server, but when the app scales out to multiple instances, sessions are lost on a different server. They migrate session storage to Azure Cache for Redis using ASP.NET Session State Provider. Now any web server can retrieve the same session data. The cache is configured with data persistence (AOF) in Premium tier to avoid data loss on restart. They set a TTL of 20 minutes for sessions. The cache handles 10,000 concurrent users with 1GB memory. Cost is around $150/month. If they had used a traditional SQL database for sessions, latency would be higher and costs would be similar but with more administrative overhead.

Scenario 3: Real-Time Leaderboard for Gaming

A mobile game company needs a real-time leaderboard that updates as players score points. They use Azure Cache for Redis with sorted sets. Each player's score is stored as a member with a score. The leaderboard is retrieved using ZREVRANGE (highest to lowest). The cache is deployed in Standard tier with 2GB memory. The application updates scores on each game event, and the leaderboard is refreshed every second. Redis handles 50,000 updates per second with sub-millisecond latency. If they had used a relational database, the leaderboard query would be slow and expensive. They also use Redis Pub/Sub to broadcast leaderboard changes to connected clients. The total cache cost is $200/month. A common mistake is not setting a max memory limit, causing evictions of important data; they set maxmemory to 80% of available memory and use volatile-lru eviction.

What Goes Wrong When Set Up Incorrectly

Common misconfigurations include: (1) Using Basic tier in production – no replication means cache is lost on a reboot, causing a cold start. (2) Not setting a TTL – cache grows unbounded, eventually exhausting memory and causing evictions. (3) Using the same cache for multiple different data types without key prefixing, leading to key collisions. (4) Not enabling SSL – data in transit is unencrypted. (5) Firewall too permissive – exposes cache to potential attacks. (6) Ignoring eviction metrics – high evictions indicate cache is too small, causing frequent cache misses and defeating the purpose.

How AZ-900 Actually Tests This

What AZ-900 Tests on This Objective

Objective 2.4: Describe Azure database and analytics services. Azure Cache for Redis is listed under 'Non-relational data offerings'. The exam expects you to know: (1) Azure Cache for Redis is an in-memory caching service that improves application performance by reducing latency and database load. (2) It is based on the open-source Redis engine. (3) Use cases: session management, content caching, real-time analytics, message brokering. (4) Tiers: Basic (single node, no SLA), Standard (replicated, 99.9% SLA), Premium (clustering, persistence, VNet). (5) It is a key-value store, not a relational database.

Common Wrong Answers and Why Candidates Choose Them

Wrong: 'Azure Cache for Redis is a relational database.' Candidates confuse it with Azure SQL Database. Reality: Redis is a NoSQL key-value store, not relational.

Wrong: 'Azure Cache for Redis automatically synchronizes with the database.' Candidates assume caching is automatic. Reality: The application must implement caching logic (cache-aside) and handle invalidation manually.

Wrong: 'Azure Cache for Redis is only for session state.' Candidates think it has a single use case. Reality: It supports many patterns including caching, pub/sub, leaderboards, etc.

Wrong: 'All tiers have an SLA.' Candidates assume every Azure service has an SLA. Reality: Basic tier has no SLA; Standard and above have 99.9%.

Wrong: 'Azure Cache for Redis provides unlimited storage.' Candidates think memory is not a constraint. Reality: It has memory limits per tier; eviction occurs when full.

Specific Terms and Values That Appear Verbatim on the Exam

'In-memory caching'

'Key-value store'

'Sub-millisecond latency'

'Session management', 'content caching', 'real-time analytics'

'Basic, Standard, Premium tiers'

'99.9% SLA' (Standard tier)

'Redis' as the underlying engine

'Eviction policies' (LRU, LFU, etc.)

Edge Cases and Tricky Distinctions

The exam may ask: 'Which service should you use to reduce database load for read-heavy workloads?' Answer: Azure Cache for Redis.

It may compare Azure Cache for Redis with Azure CDN: CDN caches static content (images, videos) at edge locations; Redis caches dynamic data (API responses, sessions) in memory.

Another distinction: Azure Cache for Redis vs. Azure Cosmos DB: Cosmos DB is a fully managed NoSQL database with multi-model support; Redis is a pure cache (though can be used as a primary database in some cases, but that's not a focus for AZ-900).

The exam may test that you cannot modify the Redis configuration file directly in Azure Cache for Redis; you must use Azure configuration options.

Memory Trick for Eliminating Wrong Answers

Use the acronym C.A.C.H.E. to remember when to choose Azure Cache for Redis: - C – Caching frequently accessed data - A – Accelerating application performance - C – Reducing database load - H – Handling session state - E – Enabling real-time scenarios (leaderboards, pub/sub)

If the scenario involves storing relational data with complex queries, it's not Redis. If it needs persistent storage with ACID transactions, it's not Redis. If it needs to cache static content globally, consider CDN instead.

Key Takeaways

Azure Cache for Redis is an in-memory caching service based on Redis, providing sub-millisecond latency for frequently accessed data.

It is a key-value store, not a relational database; use it to reduce database load and improve application performance.

Tiers: Basic (no SLA), Standard (99.9% SLA, replicated), Premium (clustering, persistence, VNet).

Common use cases: session management, content caching, real-time analytics, message brokering.

The application must implement caching logic (cache-aside pattern) and set TTLs; automatic synchronization with the database does not occur.

Memory is limited per tier; when full, eviction policies (e.g., LRU) remove old data.

On the exam, know the difference between Azure Cache for Redis (in-memory cache) and Azure Cosmos DB (durable NoSQL database).

Basic tier has no SLA; Standard tier has 99.9% SLA.

Use SSL port (6380) for secure connections; non-SSL port (6379) is available but not recommended.

Azure Cache for Redis is part of Objective 2.4 (Azure database and analytics services).

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Azure Cache for Redis

In-memory key-value store (cache)

Sub-millisecond latency for cached data

Limited memory size per tier

Data is volatile (unless persistence enabled in Premium)

Primarily used to accelerate existing databases

Azure Cosmos DB

Fully managed NoSQL database (multi-model)

Millisecond latency (single-digit ms) at any scale

Elastic storage (scales to petabytes)

Data is durable by default with multiple consistency levels

Used as a primary database for global applications

Watch Out for These

Mistake

Azure Cache for Redis is a relational database.

Correct

It is a NoSQL key-value store (in-memory cache), not a relational database. It does not support SQL queries or schema enforcement.

Mistake

Azure Cache for Redis automatically synchronizes with the underlying database.

Correct

There is no automatic synchronization. The application must implement caching logic (cache-aside pattern) and handle cache invalidation when data changes.

Mistake

All Azure Cache for Redis tiers provide an SLA for availability.

Correct

Only Standard and above (Standard, Premium, Enterprise) have an SLA (99.9% or higher). The Basic tier has no SLA.

Mistake

Azure Cache for Redis can store unlimited amounts of data.

Correct

It has a fixed memory limit based on the selected tier (e.g., 250 MB for C0, up to 1.2 TB for Premium with clustering). When memory is full, eviction policies are triggered.

Mistake

Azure Cache for Redis is only useful for session state management.

Correct

While session state is a common use case, it also supports content caching, real-time leaderboards, message brokering (Pub/Sub), distributed locks, and more.

Frequently Asked Questions

What is the difference between Azure Cache for Redis and Azure Redis Cache?

They are the same service. The official name is 'Azure Cache for Redis'. Older documentation may refer to it as 'Azure Redis Cache'. On the AZ-900 exam, use the current name: Azure Cache for Redis.

Does Azure Cache for Redis automatically sync with my SQL database?

No. Azure Cache for Redis is a passive cache. Your application must implement the cache-aside pattern: check the cache first, if missing, fetch from the database, store in cache, and return. You also need to invalidate or update the cache when the database changes.

What is the SLA for Azure Cache for Redis?

Basic tier has no SLA. Standard tier has a 99.9% SLA. Premium tier has 99.9% SLA (or 99.95% with clustering). Enterprise tier offers up to 99.99% SLA. Always verify the latest SLA on the Azure SLA page.

Can I use Azure Cache for Redis as a primary database?

While Redis can be used as a primary database (e.g., with persistence), Azure Cache for Redis is primarily designed as a caching layer. For production primary database workloads, consider Azure Cosmos DB or Azure SQL Database. On the exam, treat it as a cache, not a primary database.

How do I connect to Azure Cache for Redis from my application?

Use the hostname (e.g., mycache.redis.cache.windows.net), port 6380 (SSL), and the access key as password. Example connection string: mycache.redis.cache.windows.net:6380,password=yourkey,ssl=True. Use a Redis client library for your language.

What is the difference between Basic, Standard, and Premium tiers?

Basic: single node, no SLA, up to 53 GB. Standard: two nodes (primary/replica), 99.9% SLA, up to 120 GB. Premium: adds clustering, data persistence (RDB/AOF), VNet support, and up to 1.2 TB with clustering. Enterprise: adds active geo-replication and Flash tier.

What happens when Azure Cache for Redis runs out of memory?

Redis uses an eviction policy to remove keys when memory is full. The default policy is 'volatile-lru' (remove least recently used keys with a TTL set). You can configure other policies like 'allkeys-lru' or 'noeviction' (which will cause writes to fail).

Terms Worth Knowing

Ready to put this to the test?

You've just covered Azure Cache for Redis — now see how well it sticks with free AZ-900 practice questions. Full explanations included, no account needed.

Done with this chapter?