diff --git a/docs/cache.txt b/docs/cache.txt index e814ce8f27..b672e412aa 100644 --- a/docs/cache.txt +++ b/docs/cache.txt @@ -332,17 +332,28 @@ the value of the ``CACHE_MIDDLEWARE_SETTINGS`` setting. If you use a custom ``max_age`` in a ``cache_control`` decorator, the decorator will take precedence, and the header values will be merged correctly.) -If you want to use headers to disable caching altogether, two utility functions -are provided. `django.utils.cache.add_never_cache_headers`` is a -function that takes a single HttpResponse object as its argument and adds -headers to ensure the response won't be cached by browsers or other caches. -``django.views.decorators.never_cache`` is a view decorator that does the same -thing but can be applied to a view function for convenience. Example:: +Disabling HTTP caching for a particular view +============================================ - from django.views.decorators.cache import never_cache - @never_cache - def myview(request): - ... +If you want to use headers to disable HTTP caching altogether for a particular +view, use one of the two utility functions the come with Django: + + * ``django.utils.cache.add_never_cache_headers`` takes a single + ``HttpResponse`` object as its argument and alters the response to adds + headers that ensure the response won't be cached by browsers or other + caches. + * ``django.views.decorators.never_cache`` is a view decorator that does the + same thing but can be applied to a view function for convenience. + Example:: + + from django.views.decorators.cache import never_cache + @never_cache + def myview(request): + # ... + +Note that these functions disable HTTP caching (as described in the 'Controlling +Cache' sections of this document) -- they do *not* disable performance caching +(as described in the first few sections of this document). .. _`Cache-Control spec`: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9