Implement Azure Managed Redis data operations, including caching, expiration, and invalidation (AI-200 Exam Prep)

This post is a part of the AI-200: Developing AI Cloud Solutions on Azure  Exam Prep Hub.
This topic falls under these sections:
Develop AI solutions by using Azure data management services (25–30%)
   --> Integrate Azure Managed Redis in AI solutions
      --> Implement Azure Managed Redis data operations, including caching, expiration, and invalidation


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Overview

Azure Managed Redis is a fully managed, in-memory data store based on Redis Enterprise. It provides high-throughput, low-latency access to frequently used application data and can be used to improve the performance and scalability of applications that otherwise depend heavily on backend databases or services.

For the AI-200: Developing AI Cloud Solutions on Azure exam, developers should understand how to implement Redis data operations and, in particular, how to use Redis for:

  • Caching frequently accessed data
  • Storing and retrieving key-value data
  • Setting expiration times on cached data
  • Removing or invalidating stale data
  • Implementing cache-aside patterns
  • Reducing database and backend-service load
  • Improving application responsiveness
  • Selecting appropriate Redis data structures
  • Designing cache keys appropriately
  • Handling cache misses
  • Understanding eviction versus expiration
  • Avoiding common Redis performance mistakes

Azure Managed Redis is generally best viewed as a high-performance cache or temporary data store, rather than the authoritative system of record. Applications should normally retain authoritative data in a durable backend such as Azure Database for PostgreSQL, Azure SQL Database, or Azure Cosmos DB.


1. Why Use Azure Managed Redis?

Traditional applications frequently retrieve data from databases or external services. Although these systems are designed for reliability and scalability, repeatedly retrieving the same information can introduce unnecessary:

  • Network traffic
  • Database CPU utilization
  • Query processing
  • Connection utilization
  • Application latency
  • Backend service load

Redis addresses this by keeping frequently accessed information in memory.

A simplified architecture looks like this:

Application
|
v
Azure Managed Redis
|
| Cache miss
v
Primary Database

When the requested information is already in Redis, the application can return it without querying the primary database.

This can dramatically reduce response times for frequently accessed information.

Common examples

Redis can be useful for caching:

  • Product information
  • User profiles
  • Configuration data
  • Frequently requested database queries
  • API responses
  • Session information
  • Authentication-related application state
  • Frequently accessed reference data
  • AI application results
  • Semantic-cache results
  • Embeddings and vectors

Azure Managed Redis supports data caching, session storage, messaging scenarios, and AI-oriented scenarios such as storing embeddings and implementing semantic caching.


2. The Cache-Aside Pattern

One of the most important caching patterns for the AI-200 exam is the cache-aside pattern, sometimes called lazy loading.

The application is responsible for checking Redis before querying the authoritative data source.

The basic process is:

1. Application receives request
|
v
2. Look for data in Redis
|
+--+--+
| |
Hit Miss
| |
v v
Return Query
data database
|
v
Store result
in Redis
|
v
Return result

Cache hit

A cache hit occurs when the requested data is already in Redis.

Application → Redis → Data returned

The database does not need to be queried.

Cache miss

A cache miss occurs when the requested data isn’t present in Redis.

The application:

  1. Queries the authoritative database.
  2. Receives the result.
  3. Stores the result in Redis.
  4. Returns the result to the caller.

This pattern allows the cache to populate naturally based on actual application usage.

Conceptual pseudocode

value = Redis.GET(key)
IF value exists:
return value
value = Database.Query(...)
Redis.SET(key, value, expiration)
return value

The important principle is that Redis is populated when the application needs the data, rather than loading the entire database into memory.


3. Why Cache-Aside Is Particularly Useful

Suppose an application has one million customer records but only 20,000 customers access the application regularly.

Loading all one million records into Redis may waste memory.

With cache-aside:

  • Frequently accessed records enter the cache.
  • Infrequently accessed records remain in the database.
  • Expired records can be removed.
  • Redis memory is focused on valuable data.

This makes the cache more efficient.

Azure’s guidance specifically identifies cache-aside as a common data-cache pattern in which data is loaded into the cache only when needed.


4. Redis Key-Value Operations

At its simplest, Redis stores data using keys and values.

For example:

Key:
customer:12345
Value:
{"id":12345,"name":"Norm","tier":"Gold"}

The application can retrieve the value using the key.

Conceptually:

SET customer:12345 {...}
GET customer:12345

A good Redis key should:

  • Be unique within the application’s namespace
  • Be predictable
  • Be easy to construct
  • Identify the cached resource clearly
  • Avoid unnecessary length
  • Avoid collisions between unrelated data

A useful naming convention might be:

customer:12345
product:9876
order:54321
embedding:document:123

For larger applications, namespaces can make keys easier to manage:

customer:profile:12345
product:details:9876
ai:response:abc123

5. Choosing Redis Data Structures

Redis supports more than simple strings.

Common data structures include:

Data StructureTypical Use
StringSimple values, JSON, counters
HashObjects with multiple fields
ListOrdered collections or queues
SetUnique unordered values
Sorted SetRanked or scored collections
StreamEvent/message processing
Vector-related structuresAI embeddings and similarity scenarios

For ordinary application caching, strings and hashes are particularly common.

For example, a customer object might be stored as a JSON string:

customer:12345
|
+-- {"id":12345,"name":"Norm","status":"Active"}

Alternatively, a Redis hash could store individual fields:

customer:12345
name → Norm
status → Active
tier → Gold

The appropriate choice depends on how the application reads and updates the data.


6. Cache Expiration

Caching introduces an important problem:

What happens when the cached value becomes stale?

Redis provides key expiration, also called a time-to-live or TTL.

For example:

customer:12345
TTL = 300 seconds

After the expiration period passes, Redis automatically removes the key.

Azure Managed Redis supports setting timeouts on keys, and expired keys are automatically removed when their configured timeout passes.


7. Why Expiration Matters

Consider an application that caches weather information.

Suppose:

weather:orlando
TTL = 5 minutes

If the weather changes, the cached information should eventually disappear so that a subsequent request retrieves fresh information.

Without expiration, stale data could remain indefinitely.

Expiration therefore provides a simple mechanism for balancing:

  • Performance
  • Memory usage
  • Data freshness

8. Choosing an Appropriate TTL

The correct TTL depends on how quickly the underlying data changes.

Short TTL

Use a short expiration time when data changes frequently.

Examples:

stock price → seconds
real-time availability → seconds/minutes
weather → minutes

Medium TTL

Useful for data that changes periodically.

Examples:

product catalog → minutes/hours
exchange rates → minutes
application configuration → minutes

Long TTL

Useful for relatively stable data.

Examples:

reference data → hours
static metadata → hours/days

There is no universally correct TTL.

The developer should consider:

  • How frequently the source data changes
  • How stale the application can tolerate the data being
  • How expensive the source query is
  • How much Redis memory is available
  • How frequently the cached value is requested

9. Expiration Versus Deletion

Expiration and explicit deletion are related but different.

Expiration

The application specifies a timeout.

SET product:123 value
EXPIRE product:123 300

Redis eventually removes the key automatically.

Explicit deletion

The application deliberately removes the key.

Conceptually:

DEL product:123

This is useful when the underlying data changes and the application knows that the cached copy is no longer valid.

Azure Managed Redis identifies expiration, eviction, and explicit deletion as distinct reasons that cached keys can disappear.


10. Cache Invalidation

Cache invalidation means removing or updating cached data when it is no longer valid.

A classic example is updating a customer record.

Suppose the database contains:

Customer 123
Status = Active

Redis contains:

customer:123
Status = Active

The application changes the database:

Status = Suspended

If Redis still contains the old value, the application could continue returning:

Status = Active

The cache is now stale.

The application therefore needs an invalidation strategy.


11. Common Cache Invalidation Strategies

There are several common approaches.

Strategy 1: Delete the cache entry

After changing the authoritative database:

UPDATE database
DEL customer:123

The next request becomes a cache miss.

The application retrieves the current value from the database and repopulates Redis.

This is often a simple and effective approach.


Strategy 2: Update the cache

Instead of deleting the cache entry, the application updates Redis with the new value.

UPDATE database
SET customer:123 = new value

The advantage is that subsequent requests can immediately use the updated cache.

The disadvantage is that the application must carefully keep the database and cache synchronized.


Strategy 3: Rely on expiration

The application allows the cached value to expire naturally.

This is simpler but potentially allows stale data to remain available until the TTL expires.

For example:

TTL = 10 minutes

A database update occurring immediately after the cache was populated could result in stale data being served for almost 10 minutes.

Therefore, expiration alone may not be sufficient when data freshness is important.


12. Combining Invalidation and Expiration

A strong caching strategy often combines explicit invalidation with TTL.

For example:

Cache customer data
TTL = 30 minutes

When the customer changes:

UPDATE database
DELETE Redis key

The TTL provides protection against stale data if the invalidation process fails, while explicit invalidation removes known-stale data immediately.

This gives the application two levels of protection:

Normal update
|
v
Explicit invalidation
|
v
Immediate freshness
Unexpected missed invalidation
|
v
TTL expiration
|
v
Eventual freshness

This is an important architectural pattern to recognize in exam scenarios.


13. Cache Invalidation and the Source of Truth

A fundamental rule is:

The cache should generally not become the authoritative source of application data.

For example:

Azure Database for PostgreSQL
|
| authoritative data
v
Azure Managed Redis
|
| cached copy
v
Application

If Redis is lost, the application should be capable of rebuilding its cache from the authoritative data source.

Azure Managed Redis is designed primarily as a cache and temporary data store rather than a primary database.


14. Handling Cache Misses

Applications must always be designed to handle cache misses.

A cache miss is not necessarily an error.

It is an expected condition.

A typical workflow is:

GET key
|
+-- Found → return value
|
+-- Not found
|
v
Query database
|
v
Store in Redis
|
v
Return value

A well-designed application should therefore never assume:

“If the value isn’t in Redis, something is broken.”

Instead:

“If the value isn’t in Redis, retrieve it from the authoritative source.”


15. Cache Stampede

A cache stampede occurs when a frequently accessed cache entry expires and many requests simultaneously attempt to rebuild it.

For example:

Popular key expires
|
+-- Request 1 → Database
+-- Request 2 → Database
+-- Request 3 → Database
+-- Request 4 → Database
+-- ...
+-- Request 10,000 → Database

The cache was supposed to reduce database traffic, but expiration temporarily creates a massive burst of database requests.

Potential strategies include:

  • Staggering expiration times
  • Using appropriate TTLs
  • Refreshing hot data before expiration
  • Coordinating cache regeneration
  • Using locking or request coalescing techniques
  • Using a background refresh strategy

The exact implementation depends on application requirements.


16. Avoiding the “Thundering Herd”

A related problem is the thundering herd effect.

Suppose thousands of requests need the same data and the cache expires.

If every request independently queries the database, the backend can become overloaded.

A common mitigation is to allow one process to refresh the data while other requests wait briefly or use the previous value where appropriate.

Conceptually:

                Cache miss
                    |
            +-------+-------+
            |               |
        First request    Other requests
            |               |
        Refresh cache    Wait/use fallback
            |
            v
        New cached value

The goal is to prevent thousands of identical backend queries.


17. Cache-Aside Write Pattern

There are multiple ways to handle writes with a cache-aside architecture.

One common approach is:

1. Update database
2. Delete corresponding Redis key

For example:

UPDATE products
SET price = 25.00
WHERE product_id = 100;
DEL product:100;

The next read retrieves the new database value and caches it.

This pattern is attractive because the database remains the source of truth.


18. Why Delete-After-Write Is Often Safer Than Cache-First Updates

Consider:

Application
|
+--> Redis
|
+--> Database

If the application updates Redis first and the database update subsequently fails, the cache could contain a value that doesn’t exist in the database.

By updating the authoritative store first and invalidating the cache afterward, the application reduces this risk.

A typical sequence is:

Database update
|
v
Cache invalidation
|
v
Next request repopulates cache

The exact transaction and failure-handling strategy should be designed according to the application’s consistency requirements.


19. Expiration Does Not Mean Eviction

This is an important exam distinction.

Expiration

A key reaches its configured TTL.

TTL reaches zero
Key expires

Eviction

Redis needs to free memory and removes keys according to its configured memory/eviction behavior.

Memory pressure
Eviction policy
Keys removed

Explicit deletion

The application deliberately removes a key.

DEL key
Key removed

These are three different mechanisms.

Azure Managed Redis documentation identifies expiration, eviction, and explicit deletion as separate causes of keys disappearing from the cache.


20. Eviction and Memory Pressure

Redis is an in-memory service, so memory management is critical.

If the cache approaches its memory capacity, Redis can remove keys according to its configured eviction behavior.

Therefore, an application should not interpret every missing key as an expiration event.

Possible causes include:

  1. TTL expiration
  2. Memory eviction
  3. Explicit deletion
  4. Cache flushing
  5. Failover/replication behavior
  6. Other infrastructure-related events

Monitoring cache metrics can help distinguish these scenarios.


21. Key Naming Best Practices

A good key strategy makes a Redis implementation easier to maintain.

Consider:

customer:12345

instead of:

12345

The first provides context.

For a larger application:

customer:profile:12345
customer:orders:12345
customer:preferences:12345

This makes it easier to understand what each key represents.

Avoid unnecessarily large keys because Redis is optimized for high-performance operations and memory usage matters.


22. Avoid Storing Excessively Large Values

Redis is designed for fast in-memory access.

Large values can:

  • Consume significant memory
  • Increase network traffic
  • Increase serialization/deserialization costs
  • Increase latency
  • Reduce cache efficiency

For example, rather than caching a massive database object containing thousands of unnecessary fields, cache only the information needed by the application.

A useful principle is:

Cache what the application needs, not everything the database can provide.

Azure’s current guidance also recommends avoiding unnecessarily large Redis values because smaller values generally provide better performance characteristics.


23. Connection Management

Applications should avoid creating a new Redis connection for every request.

For example, this is generally a poor pattern:

Request 1 → Create connection → Redis → Close
Request 2 → Create connection → Redis → Close
Request 3 → Create connection → Redis → Close

Instead, applications should generally use a long-lived connection/client that can be reused across requests.

For .NET applications using StackExchange.Redis, Microsoft recommends a single long-lived ConnectionMultiplexer rather than creating a new connection for each request.

This reduces:

  • Connection overhead
  • Resource consumption
  • Latency
  • Connection churn

24. Connection Resilience

Applications should also assume that Redis connections can occasionally experience interruptions because of:

  • Maintenance
  • Failover
  • Network problems
  • Infrastructure events

The application should be designed to reconnect and handle transient failures appropriately.

For example:

Application
|
v
Redis connection
|
failure
|
v
Reconnect
|
v
Continue processing

For a cache, a Redis outage should ideally degrade application performance rather than completely destroy application functionality.

The application can fall back to the authoritative database when appropriate.


25. Redis as a Performance Layer

A useful way to conceptualize Azure Managed Redis is as a performance layer:

                +----------------+
                |   Application  |
                +-------+--------+
                        |
                        v
                +---------------+
                | Azure Managed |
                |     Redis     |
                +-------+-------+
                        |
                  Cache miss
                        |
                        v
                +---------------+
                |   Database    |
                +---------------+

The application gets:

  • Fast reads from Redis
  • Durable storage from the database
  • Reduced database workload
  • Better scalability

This separation is central to effective caching architecture.


26. Caching AI Application Data

Azure Managed Redis is particularly relevant to AI applications.

Possible cached information includes:

  • Embeddings
  • Frequently retrieved documents
  • AI-generated responses
  • Prompt-related information
  • Semantic-cache entries
  • User session state
  • Frequently accessed metadata

For example, a semantic cache might store:

Question:
"What is our vacation policy?"
Embedding / semantic representation
|
v
Redis
|
v
Previously generated answer

If another request is sufficiently similar, the application may reuse an existing result rather than repeatedly invoking an AI model.

This can reduce:

  • Model calls
  • Latency
  • Cost
  • Backend processing

Azure Managed Redis specifically supports AI scenarios such as vector storage and semantic caching.


27. Caching Versus Persistent Storage

A common exam trap is assuming that Redis should replace the database.

Generally:

RequirementBetter Choice
Authoritative relational dataPostgreSQL
Durable transactional dataPostgreSQL
Large persistent document storeCosmos DB or other durable storage
Frequently accessed temporary dataRedis
Session stateRedis
Short-lived application cacheRedis
Semantic cacheRedis
Embedding/vector workloadsRedis or specialized vector-capable data service

Redis should generally complement rather than replace the authoritative data store.


28. Cache Invalidation Strategies Compared

StrategyAdvantageDisadvantage
TTL expirationSimpleData can remain stale until TTL expires
Explicit deletionImmediate invalidationApplication must know when data changes
Update cacheFresh cache immediatelyMore synchronization complexity
TTL + deletionStrong balanceRequires both mechanisms
Background refreshGood for hot dataMore application complexity

For many applications, TTL plus explicit invalidation is an effective design.


29. Common Exam Scenario

Suppose an application retrieves product information from Azure Database for PostgreSQL.

The application receives thousands of requests for the same product.

The best architecture is:

Request
|
v
Redis GET product:123
|
+---- Hit ----> Return cached product
|
+---- Miss
|
v
Query PostgreSQL
|
v
Store in Redis with TTL
|
v
Return

When the product changes:

Update PostgreSQL
|
v
Delete product:123 from Redis

The next request retrieves the current value and repopulates the cache.

This is a classic cache-aside implementation.


30. Common Mistakes to Avoid

Mistake 1: Treating Redis as the primary database

Redis should generally be treated as a cache or temporary store, not the authoritative system of record.

Mistake 2: Never setting expiration

Without expiration, stale data can remain indefinitely and memory consumption can increase.

Mistake 3: Relying only on expiration

If freshness is important, explicit invalidation may be necessary.

Mistake 4: Confusing expiration with eviction

Expiration happens because a TTL expires.

Eviction happens because Redis needs memory and removes keys according to its configured policy.

Mistake 5: Creating a connection for every request

Reuse long-lived Redis connections/clients.

Mistake 6: Caching enormous objects

Large values increase memory and network costs.

Mistake 7: Ignoring cache misses

A cache miss should be an expected application path.

Mistake 8: Updating the cache without considering database consistency

The authoritative data store and cache must be handled carefully during writes.

Mistake 9: Assuming cached data is permanent

Redis is an in-memory service. Applications should be designed to tolerate cache loss and rebuild cached information when necessary.


31. AI-200 Exam Takeaways

For the AI-200 exam, remember these core concepts:

Cache-aside

Check Redis → if miss, retrieve from database → store in Redis → return data.

Expiration

A TTL automatically removes a key after the configured timeout.

Invalidation

Explicitly remove or update cached data when the authoritative data changes.

Eviction

Redis removes keys because of memory pressure according to its configured eviction behavior.

Source of truth

Keep authoritative data in a durable backend.

Connection management

Reuse long-lived Redis client connections rather than creating connections for every request.

Performance

Keep cached values reasonably small and avoid unnecessarily expensive Redis operations.

Resilience

Design the application to tolerate Redis connection failures and cache misses.

AI scenarios

Redis can support semantic caching, embedding/vector storage, session state, and other high-performance AI application patterns.


Practice Exam Questions

Question 1

An application retrieves product information from Azure Database for PostgreSQL. The same products are requested thousands of times per minute. The developer wants to reduce database load while keeping PostgreSQL as the authoritative data source.

Which approach should the developer implement?

A. Store all PostgreSQL tables permanently in Redis and stop using PostgreSQL for reads.

B. Use a cache-aside pattern in which the application checks Redis first and retrieves data from PostgreSQL on a cache miss.

C. Write every PostgreSQL transaction directly to Redis and use Redis as the primary database.

D. Query PostgreSQL for every request and use Redis only for logging.

Answer: B

Explanation:
The cache-aside pattern checks Redis first. On a cache miss, the application queries PostgreSQL, stores the result in Redis, and returns it. PostgreSQL remains the authoritative data source. This reduces repeated database queries while preserving the database as the system of record.


Question 2

An application caches weather information in Azure Managed Redis. Weather information should never remain in the cache for more than five minutes.

What should the developer configure?

A. A Redis key expiration of five minutes.

B. A five-minute Redis connection timeout.

C. A five-minute eviction policy.

D. A five-minute database transaction timeout.

Answer: A

Explanation:
Key expiration uses a TTL to automatically remove a key after a specified period. A five-minute TTL ensures the cached weather information does not remain cached beyond the configured lifetime. Expiration is different from eviction, which occurs because of memory pressure.


Question 3

A customer record is stored in both PostgreSQL and Redis. The customer updates their address. The application successfully updates PostgreSQL but the old address remains in Redis.

What is the best way to ensure the next read retrieves the current address?

A. Increase the Redis memory allocation.

B. Restart the Redis instance.

C. Delete the cached customer key after successfully updating PostgreSQL.

D. Disable Redis expiration.

Answer: C

Explanation:
Deleting the cached key explicitly invalidates the stale value. The next request causes a cache miss, retrieves the current customer record from PostgreSQL, and can repopulate Redis.


Question 4

A developer notices that Redis keys are disappearing before their expected TTL values are reached. The Redis instance is experiencing high memory utilization.

What is the most likely explanation?

A. PostgreSQL automatically deleted the Redis keys.

B. The Redis connection expired.

C. The application’s DNS record changed.

D. Redis evicted keys because of memory pressure.

Answer: D

Explanation:
Expiration and eviction are different. A key can be removed because its TTL expires, but Redis can also remove keys when memory pressure requires space to be reclaimed according to the configured eviction behavior.


Question 5

A web application creates a new Redis connection every time an HTTP request needs to retrieve cached data.

What should the developer generally do instead?

A. Use a single long-lived Redis client/connection that can be reused across requests.

B. Create two Redis connections for every request to provide redundancy.

C. Disable connection reuse so that every request receives a fresh connection.

D. Store Redis connection objects in every cached value.

Answer: A

Explanation:
Creating connections repeatedly introduces unnecessary overhead and connection churn. Redis applications should generally reuse long-lived client connections. For example, .NET applications using StackExchange.Redis commonly use a shared, long-lived ConnectionMultiplexer.


Question 6

A developer wants cached customer information to remain available for up to one hour but also wants changes to a customer record to become visible immediately.

Which strategy is most appropriate?

A. Use a one-hour TTL and never invalidate the cache.

B. Disable expiration and update Redis once per day.

C. Use a one-hour TTL and explicitly invalidate the customer’s cache entry when the database record changes.

D. Store the customer only in Redis and remove the PostgreSQL record.

Answer: C

Explanation:
Combining TTL with explicit invalidation provides two layers of protection. Explicit invalidation removes known-stale data immediately, while the TTL prevents an entry from remaining cached indefinitely if an invalidation event is missed.


Question 7

Thousands of users request the same product. The product’s Redis entry expires at nearly the same time, causing thousands of requests to query PostgreSQL simultaneously.

What problem does this scenario represent?

A. Cache encryption failure.

B. Cache stampede or thundering herd.

C. Redis key collision.

D. Database normalization.

Answer: B

Explanation:
A cache stampede occurs when a popular cached item expires and many requests simultaneously attempt to rebuild the cache. This can overwhelm the backend database. Techniques such as request coordination, locking, staggered expiration, and background refresh can reduce the problem.


Question 8

An application stores the following information in Redis:

customer:12345
customer:12346
customer:12347

What is the primary benefit of this naming convention?

A. It automatically encrypts the values.

B. It prevents Redis from expiring the keys.

C. It increases the Redis memory limit.

D. It provides a predictable namespace that identifies the type and identity of the cached resource.

Answer: D

Explanation:
A structured naming convention makes keys predictable, understandable, and easier to manage. Prefixes such as customer: distinguish customer records from other application data.


Question 9

An AI application frequently receives semantically similar questions. Generating a response for every request requires an expensive model invocation.

How could Azure Managed Redis help?

A. Cache previously generated results or semantic representations so suitable requests can reuse existing results.

B. Replace the AI model with Redis commands.

C. Store all model training data exclusively in Redis.

D. Use Redis expiration to permanently store every model response.

Answer: A

Explanation:
Azure Managed Redis can support semantic caching and AI workloads. An application can cache suitable AI responses or related representations and reuse them when a later request is sufficiently similar. This can reduce model calls, latency, and cost.


Question 10

A developer is designing an application that uses Redis for caching. The developer wants the application to continue functioning if cached data disappears.

Which design is most appropriate?

A. Treat Redis as the only authoritative copy of the data.

B. Disable all Redis expiration and eviction mechanisms.

C. Keep authoritative data in a durable database and design the application to repopulate Redis after cache misses.

D. Write all application data to Redis and periodically delete the database.

Answer: C

Explanation:
A resilient caching architecture treats Redis as a performance layer rather than the authoritative data store. If a cached item disappears because of expiration, eviction, deletion, or another event, the application can retrieve the authoritative value from the durable database and repopulate the cache.


Final Study Summary

For the AI-200 exam, the most important distinction is between the authoritative data store and the cache.

A typical architecture is:

                    Application
                         |
                         v
                 Azure Managed Redis
                    /           \
                 Hit             Miss
                  |                |
                  v                v
              Return          Query database
                                 |
                                 v
                           Populate Redis
                                 |
                                 v
                              Return

When data changes:

Update authoritative database
|
v
Invalidate Redis entry
|
v
Next request repopulates cache

And when a TTL expires:

TTL reaches zero
|
v
Key expires
|
v
Next request causes cache miss
|
v
Retrieve fresh data

Keep these concepts distinct:

ConceptMeaning
Cache hitRequested data exists in Redis
Cache missRequested data isn’t in Redis
TTLAmount of time a key is allowed to remain cached
ExpirationAutomatic removal after TTL expires
InvalidationApplication-driven removal/update of stale data
EvictionRemoval caused by memory pressure and eviction policy
Cache-asideApplication checks cache, then authoritative store on a miss
Cache stampedeMany requests rebuild an expired cache entry simultaneously
Source of truthDurable system containing authoritative data
Semantic cacheCache that can reuse results for sufficiently similar AI requests

The exam-ready mental model is simple:

Cache for speed, expire for freshness, invalidate when you know data changed, and keep the database as the source of truth.


Go to the AI-200 Exam Prep Hub main page

Leave a comment