Troubleshooting and Optimization

An application uses cache-aside with Amazon ElastiCache for product records. After a successful database update, subsequent reads keep returning the old cached record; which action best addresses this?

Show the answer

Correct answerB. Invalidate the corresponding cached record

AWhy not this: A longer time to live permits the stale record to remain cached longer.

BWhy this is right: Removing the stale entry causes the next read to retrieve and cache the updated database value.

CWhy not this: Additional memory increases cache capacity but does not refresh existing entries.

DWhy not this: Database read replicas do not remove an outdated value already stored in the cache.

Invalidating the updated record forces the next cache-aside read to fetch current data from the database and repopulate the cache. Increasing the time to live would allow the stale value to remain longer.