The Django framework makes it easy to produce dynamic pages and generate content "on the fly" when a page is requested. Under certain circumstances, this can have a negative impact on your site's performance, such as when you start generating a large amount of traffic or if your pages use intensive database queries. In these situations, you can use the built-in caching mechanisms to reduce the amount of processing that goes into serving each request.
In this chapter, we will:
Explore the basics of caching output
Compare the different cache backends that Django offers
Configure your site for caching
Cache content on a per-view basis
Cache content from within Django templates
Use the low-level cache API to cache specific pieces of data
Cache your entire site automatically
Explore strategies for using different cache mechanisms together
Configure Django to work with caches other than your own