summaryrefslogtreecommitdiff
path: root/docs/cache.txt
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2006-03-30 23:29:21 +0000
committerLuke Plant <L.Plant.98@cantab.net>2006-03-30 23:29:21 +0000
commit4d76b4df25d0270d3b9885a2c8fa2efcbf58a024 (patch)
tree340b31de4b96459a15e44c6b06b427979de7a9d8 /docs/cache.txt
parent8102d1262e9b51663dc911882a39717cb496b0ab (diff)
magic-removal: Refactored never_cache decorator to provide a utility
function that can be used inside views, and added docs. git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/cache.txt')
-rw-r--r--docs/cache.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/cache.txt b/docs/cache.txt
index f1f5668137..e814ce8f27 100644
--- a/docs/cache.txt
+++ b/docs/cache.txt
@@ -332,6 +332,18 @@ 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::
+
+ from django.views.decorators.cache import never_cache
+ @never_cache
+ def myview(request):
+ ...
+
.. _`Cache-Control spec`: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
Other optimizations