
Answer-first summary for fast verification
Answer: Use a Lazy Loading strategy with TTL
Use a Lazy Loading strategy with TTL Lazy loading is a caching strategy that loads data into the cache only when necessary. Whenever your application requests data, it first requests the ElastiCache cache. If the data exists in the cache and is current, ElastiCache returns the data to your application. If the data doesn't exist in the cache or has expired, your application requests the data from your data store. Your datastore then returns the data to your application. In this case, data that is actively requested by users will be cached in ElastiCache, and thanks to the TTL, we can expire that data after a minute to limit the data staleness.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are developing a web application where users have the ability to follow one another. Due to the nature of the application, some users will become more popular than others, leading to frequent data requests for their profiles. Presently, user data is housed in an RDS instance. To enhance the read performance, your Developer has suggested employing ElastiCache as a caching layer. However, storing the entire dataset of users in ElastiCache would be prohibitively expensive. Therefore, you need to cache only the profiles of the most frequently requested users. Given that the website experiences high traffic, it is acceptable for the cached data to be slightly outdated, provided it is no more than one minute old.
What caching strategy would you suggest implementing?
A
Use a Write Through strategy without TTL
B
Use a Lazy Loading strategy with TTL
C
Use a Lazy Loading strategy without TTL
D
Use a Write Through strategy with TTL
No comments yet.