DVA-C02 exam dumps

DVA-C02 practice question 104 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 104

Single answer

You are developing a high-traffic e-commerce application that uses an Amazon DynamoDB table to store product details. To improve performance and reduce read latency, you decide to integrate Amazon ElastiCache as a caching layer. Which caching strategy is most appropriate if you want to ensure that the cache always contains the most up-to-date product details whenever data is updated in DynamoDB?

  1. A

    Write-through caching

  2. B

    Read-through caching

  3. C

    Lazy loading

  4. D

    Cache-aside with time-to-live (TTL)

Show answer and explanation

Correct answer: A

Explanation

Write-through caching is the best choice when you need to ensure that the cache always contains the most up-to-date data. In this strategy, updates to the database are immediately mirrored in the cache, eliminating the risk of stale data. Other strategies, such as lazy loading or cache-aside, may result in stale data in the cache since they update the cache only after a cache miss or when TTL expires.

  • A. Correct.

    Write-through caching ensures that whenever data is written to the database, it is also written to the cache simultaneously. This guarantees that the cache is always up-to-date, making it the most appropriate strategy in this scenario.

  • B. Incorrect.

    Read-through caching is used to fetch data from the cache or the database when a read request is made. However, it does not ensure that the cache is updated when the database is updated, so this is not suitable for the given requirement.

  • C. Incorrect.

    Lazy loading populates the cache only when a cache miss occurs. While it reduces initial cache overhead, it does not ensure that the cache is updated when DynamoDB data changes, which makes it unsuitable for this scenario.

  • D. Incorrect.

    Cache-aside with time-to-live (TTL) allows data to expire after a set duration, requiring a database fetch on expiration. While it can reduce stale data, it does not guarantee immediate synchronization with DynamoDB upon updates.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam