Popular articles cache

DesignEasy25 min

Your task

Design a read cache in front of a database for a small site whose home page shows the 'top 10 most popular articles'. Computing that list is a moderately expensive query, the home page is the most-visited page, and the ranking only needs to update every few minutes. Describe how you cache the result and keep it reasonably fresh.

It covers

  • Read cache
  • Invalidation
  • Ttl