Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

2. Fundamentals > Caching

Caching

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.

Note

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.

Setting Headers Manually

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial