
Ultimate access to all questions.
Deep dive into the quiz with AI chat providers.
We prepare a focused prompt with your quiz and certificate details so each AI can offer a more tailored, in-depth explanation.
A company hosts a three-tier web application in the AWS Cloud. A Multi-AZ Amazon RDS for MySQL server forms the database layer. Amazon ElastiCache forms the cache layer. The company wants a caching strategy that adds or updates data in the cache when a customer adds an item to the database. The data in the cache must always match the data in the database.
Which solution will meet these requirements?
A
Implement the lazy loading caching strategy
B
Implement the write-through caching strategy
C
Implement the adding TTL caching strategy
D
Implement the AWS AppConfig caching strategy
Explanation:
The correct answer is B. Implement the write-through caching strategy.
Simultaneous Updates: Write-through caching ensures that when data is written to the database, it is also immediately written to the cache. This guarantees that the cache always contains the most recent data.
Data Consistency: The requirement states that "the data in the cache must always match the data in the database." Write-through caching maintains this consistency by updating both storage layers simultaneously.
Real-time Synchronization: When a customer adds an item to the database, the write-through strategy automatically adds or updates that data in the cache, ensuring immediate consistency.
A. Lazy Loading (Cache-Aside): This strategy only loads data into the cache when it's requested (read operations). It doesn't proactively update the cache on write operations, which could lead to stale data.
C. Adding TTL Caching Strategy: Time-To-Live (TTL) is an expiration mechanism, not a write strategy. It helps manage cache freshness but doesn't ensure immediate consistency when data is written to the database.
D. AWS AppConfig Caching Strategy: AWS AppConfig is a service for managing application configurations, not a database caching strategy. It's unrelated to maintaining cache-database consistency.
This approach perfectly aligns with the company's requirement to have cache data always match database data when customers add items.