Cached product prices in Azure Managed Redis must expire after five minutes, and must disappear immediately when a price changes. What should you do?
- A Set a 300-second TTL on each key and delete the key when its price is updated (correct answer)
- B Rely on the maxmemory eviction policy
- C Refresh the whole cache from a scheduled job every five minutes
- D Store prices without a TTL and flush the cache once a day
Shortcut: Fresh Redis data = TTL for expiry + delete the key on update. Eviction only happens under memory pressure, and scheduled refreshes or daily flushes leave stale prices in the cache.
A TTL (for example
SET with EX 300) removes stale entries automatically, and deleting the key when the price changes invalidates it at once; the next read reloads it from the database (cache-aside). Eviction only happens under memory pressure, and scheduled refreshes or daily flushes leave stale prices in the cache.