Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Caching in web applications can be a complex topic, spanning a variety of tiers. Browsers, proxies, servers, and other devices can all cache content and resources independently. There are a number of HTTP headers that can be used to inform consumers of how to handle content; we’ll examine a few here.
For the purposes of this conversation, we can assume that “caching” refers to control provided by HTTP headers and is not inclusive of external services such as Memcached.
Using the headers helper we
discussed earlier, you can set any desired headers to influence
downstream caching. The code in Example 2-29 will inform
consumers that the content should be cached for one hour.