Which kind information to cache in memory?
It's easy to decide which information to cache in memory in a node-like web-site, where you have few nodes, most popular pages, you can keep in memory. But what about site开发者_Go百科s where the whole mass of pages has same chances to be required?
For example - Wiki-sites or social nets?
added
Something's wrong with "add comment" button... Well, actually, I ask question like "something hurts, doctor, help me", isn't it?)
So, after logical caching of static part of site, you can only cache as much ready results as you can (not in memory, but somewhere). That's all you can do, сorrect me if I'm wrong.
Identify parts of your Web content that is static, potentially most popular, large (for instance animations, images). These are usually the parts you should consider first.
Here you can find excellent Caching Tutorial
Caching makes sense if and only if you have some (spatial, temporal) locality, such as the most frequent queries (temporal locality). If you have a model where each page is fetched with uniform probability, then caching is a complete nonsense, yes.
One thing to analyze is if the information in your pages needs to be always up to date or if you could delay the updates holding them in a cache for period of time. This dependes on the kind of site.
There are some real big sites that reaches to the point of having inconsistent data for a while until all cache nodes are updated.
精彩评论