Guided architecture tour · 6–8 min
Remember answers you use often — ElastiCache
Use a cache to reduce repeated reads without trusting stale data forever.
This tour teaches architecture decisions. Its services are not provisioned in the emulator.
Your goal
Use a cache to reduce repeated reads without trusting stale data forever.
Why this matters
Many visitors ask for the same product details. You will save a reusable answer, fetch from the main store when it is missing, and refresh it when products change.
Words you will use
A cache is a fast place for reusable data. A cache hit finds a saved answer; a miss does not. Invalidation removes a saved answer that should no longer be used.
How to proceed
Read each situation and choose an answer. The lesson explains the result. Try again if needed, then continue through all three decisions and finish the tour.
1. Cache the repeated answer
A product page reads the same description thousands of times. The database is busy repeating that work. Choose a useful role for ElastiCache in this design.
What should the cache hold?
A reusable copy of suitable product data.
A cache can save repeated retrieval work. In this example, the database remains the main record and the cached value can be rebuilt. Decide which data may safely be reused and for how long.
Repeated product requests can use a saved answer.
Product ID → cache key → reusable product data2. Handle a missing answer
The cache does not have product p-9, perhaps because the entry expired. Choose the app’s next step rather than treating the product as deleted.
What should a cache miss do?
Read the main store, then cache an appropriate result.
In a cache-aside design, the app checks the cache and then reads the main store on a miss. Only return not found if the main store supports that result. Cache errors should also have a deliberate fallback.
A miss can still return the correct product.
Cache miss → database read → cache suitable result → reply3. Handle a changed price
The price in the database changes, but the cache still has the old price. You must avoid quoting old values indefinitely. Choose a refresh plan.
What should happen to the cached value?
Expire, invalidate, or update it according to the app’s rules.
Caching needs a freshness policy. Choose a lifetime or an update process that fits the data. For purchases, verify important values in the authoritative transaction rather than trusting an old screen.
The app has a planned way to retire stale answers.
Product update → refresh or remove cached copyPractice, then check your understanding
In the interactive tour, make each decision before seeing the outcome. Wrong answers receive coaching, and replay gives you a fresh attempt without duplicating earned XP.
Read the official AWS documentation for service behavior and production details.