diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-11-29 16:57:18 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-11-29 16:57:18 +0000 |
| commit | f2f6e70b08b1142055e33e75f58cfe7fbb5d868f (patch) | |
| tree | a47081520721e1f9c6d7e728e30421e65a89caa0 /docs | |
| parent | 0171f007613d42cf26eb2742cfe73ea82fd4b43d (diff) | |
Fixed #5813 -- Taught the CacheMiddleware to respect any max-age HTTP header
when setting the expiry time. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6736 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/cache.txt | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/cache.txt b/docs/cache.txt index 4f177b8c07..6dfe2bf5ee 100644 --- a/docs/cache.txt +++ b/docs/cache.txt @@ -263,6 +263,18 @@ See the `middleware documentation`_ for more on middleware. .. _`middleware documentation`: ../middleware/ +**New in Django development version** + +If a view sets its own cache expiry time (i.e. it has a ``max-age`` section in +its ``Cache-Control`` header) then the page will be cached until the expiry +time, rather than ``CACHE_MIDDLEWARE_SECONDS``. Using the decorators in +``django.views.decorators.cache`` you can easily set a view's expiry time +(using the ``cache_control`` decorator) or disable caching for a view (using +the ``never_cache`` decorator). See the `using other headers`__ section for +more on these decorators. + +__ `Controlling cache: Using other headers`_ + The per-view cache ================== @@ -566,7 +578,7 @@ the value of the ``CACHE_MIDDLEWARE_SETTINGS`` setting. If you use a custom precedence, and the header values will be merged correctly.) If you want to use headers to disable caching altogether, -``django.views.decorators.never_cache`` is a view decorator that adds +``django.views.decorators.cache.never_cache`` is a view decorator that adds headers to ensure the response won't be cached by browsers or other caches. Example:: from django.views.decorators.cache import never_cache |
