Ask HN: How to cache for logged in users?

How would you go about caching for logged in users?

I have thought about caching "blocks" of the page and then assemble the entire page before sending it to the user, but are there any better, more elegant solutions to the problem?

  • I keep track of logged in users via sessions that are stored in a DB.

    Every time the user goes to a new page it is updated. This happens so frequently that caching doesn't really make sense. Accuracy is also important.

  • It's easy -- assemble the 'blocks' on the client-side.