Chapter 23. Configuring Caching

What You’ll Learn in This Hour

  • How to configure cache backends
  • How to implement a per-site cache
  • How to implement a per-view cache
  • How to manage access to cached pages

One of Django’s best features is that it lets you easily generate web pages on-the-fly. It saves you a lot of development and maintenance time. However, this advantage comes at a price. Each time a request comes in, Django spends many cycles in database queries and page generation. On small to medium websites, this isn’t much of a problem. However, on large sites that receive several requests per second, this can quickly become a problem.

Django’s caching framework solves this problem nicely. Using the cache framework, you can cache web pages and objects ...

Get Sams Teach Yourself Django in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.