1. 程式人生 > >Ask HN: How to implement caching for dynamic user data in sites like HN, Reddit?

Ask HN: How to implement caching for dynamic user data in sites like HN, Reddit?

Why would you start by caching it?

What are you storing the data in currently? If relational, I'd advise starting with simple relational tables (post_comments, user_comment_likes, etc). Render the HTML for logged in users based on querying that, and see how far you can get.

The source code for historical versions of both reddit and HN is available, so you could check that to see what they do. But caching probably won't be necessary for a long time.