AI-200 practice question 4 of 10

You optimize an Al inference API that uses Redis caching. You must reduce the risk of serving outdated data while minimizing cache management overhead. You need to implement the caching strategy that satisfies the requirements. What should you do?

Full set: 67 questions
Answer options
A: Reset expiration on each read.
B: Disable expiration for cache keys.
C: Set eviction policy to allkeys-lru.
D: Trigger invalidation when source data changes Correct answer
Correct Answer:
D. Trigger invalidation when source data changes
Explanation

To ensure data consistency and prevent serving outdated data, the most effective caching strategy is to trigger cache invalidation when the underlying source data changes. This proactive approach guarantees that the AI inference API will fetch the latest data on the next request, minimizing the risk of stale data while avoiding the overhead of excessively short expiration times or complex synchronization mechanisms.

Why Incorrect

A. Resetting expiration on read (sliding expiration) prolongs the life of potentially stale data if it is frequently accessed.
B. Disabling expiration ensures data remains in the cache indefinitely, leading to highly outdated data being served.
C. The allkeys-lru eviction policy manages memory by removing least recently used keys; it does not ensure data freshness.

References

Microsoft Learn: Caching guidance - Azure Architecture Center. Section: "Managing data consistency" and "Cache invalidation". Document ID: azure/architecture/best-practices/caching.

Scroll to Top