Book Image

Django 1.0 Template Development

Book Image

Django 1.0 Template Development

Overview of this book

Table of Contents (17 chapters)
Django 1.0 Template Development
Credits
About the Author
About the Reviewers
Preface
Index

General caching strategies


With different caching mechanism options such as per-site, per-view, low-level, and so on, it may be difficult to determine which one fits your site best. There is no single "right" answer, but let's look at a general strategy for implementing caching on your site.

The per-site cache is fast and easy to implement. You don't have to remember to implement caching in your views, and you can configure the caching to prevent authenticated requests from getting cached.

What if you have views that require authentication? With the per-site cache enabled, these views won't get the benefit of the cache. In this case, you may want to implement low-level caching to store the bits of data that aren't user-specific. But sometimes, this isn't possible, for example when you present data specific to the logged-in user.

If you are presenting a lot of user-specific data, look for places in your templates where you can add caching, such as a dynamically generated menu or navigation system...