Ask HN: What do you use for site caching?
Caching is a massive topic that covered a multitude of different points along your chain from page creation through to the browser. I&#x27;m going to give a very brief overview of a few different solutions:<p>* Cache frequent database requests with an in-memory database, key&#x2F;value store. There&#x27;s two big players in this field, memcached and Redis. Personally I prefer the latter.<p>* Cache static content. This would be a CDN and can run either as a separate domain or between the browser and your servers.<p>* Cache partial page assets (eg half pages on dynamic sites). There&#x27;s a multitude of ways you can do this including using a key&#x2F;value store. This reduces the amount of content that needs to be dynamically generated even if some of the page still has to be.<p>* Cache the entire page. This can be done via solutions like varnish or via a CDN. CDNs that support this level of caching can be configured either via their management portal or by setting caching headers in your your HTTP response. Usually it will different caching headers to the ones your browser will take notice of, but this is often configurable.<p>* Browser caching. This is one that I&#x27;ve found developers et al often overlook. It&#x27;s also the level of caching that can cause the most headaches. But it&#x27;s the cheapest to implement and cheapest to run so it&#x27;s definitely worth getting browser caching right first.<p>[edit]<p>I forgot to add:<p>* Full page caching with a Javascript API model. This is something a lot of popular dynamic sites do. Basically the entire HTML page served is a template and the Javascript library draws the dynamic content on top of it. This way all of your assets can be cached and a lot of needless dynamic text rendering is distributed amongst the clients instead of handled on the server. The downside to this is it&#x27;s more complicated to build with more places to break (users running weird browsers, disabling JS, attackers, etc). But the gains can also be significant.