Course menuDVA-C02

Exams / DVA-C02 / Caching and specialised data stores / Question 1

DVA-C02 practice question: Caching and specialised data stores

Development with AWS Services A free question from our original DVA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.

A product catalogue service reads from an Amazon RDS database and is adding Amazon ElastiCache. Only a small share of products are viewed often, and the team wants to cache only the data that is actually requested. Prices change a few times a day, and a cached price must not be more than 15 minutes out of date. Which strategy fits best?

Choose one answer.

  1. A. Write-through caching only, updating the cache on every database write.
  2. B. Lazy loading, with a time to live of 15 minutes on each cached item.
  3. C. Lazy loading with no expiry, so items stay in the cache as long as possible.
  4. D. Load the whole catalogue into the cache at start-up and never expire it.
Show the answer and explanation

Answer: B

  • A. Wrong: Write-through caches every written item, including products nobody views, which wastes memory (cache churn).
  • B. Right: Correct. Lazy loading caches only items that are read, and the TTL makes stale entries expire within 15 minutes.
  • C. Wrong: Without a TTL, a cached price is never refreshed after a change, so data can stay stale indefinitely.
  • D. Wrong: This caches unread data and leaves every entry stale once prices change.

Explanation

Lazy loading fills the cache on a miss, so only requested data is stored, but cached data can become stale. Adding a TTL limits how stale it can get. Write-through keeps data fresh but caches everything that is written. Choosing a strategy means weighing freshness, memory use and miss penalty.

Study

Keep practising

Answer questions with a score at the end, or practise just this topic with the explanation after each one. No sign-up needed.