diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2009-09-28 21:54:54 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2009-09-28 21:54:54 +0000 |
| commit | 6e3a72585a727d46ea03871f14a9a2f0f15fbf93 (patch) | |
| tree | aa6c19928b34ea2513527d9ff374120ede19841d /docs/topics/cache.txt | |
| parent | a97648a7e03fb95b09e888e5d59d82d57fb289b7 (diff) | |
Added 'key_prefix' keyword argument to cache_page()
This was available before r11586, but undocumented. It has now been
re-added with documentation and explicit support, as it seems like a useful
feature and people were using it before.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11595 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics/cache.txt')
| -rw-r--r-- | docs/topics/cache.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/topics/cache.txt b/docs/topics/cache.txt index 174dbae121..c9fd1b4012 100644 --- a/docs/topics/cache.txt +++ b/docs/topics/cache.txt @@ -361,6 +361,17 @@ then requests to ``/foo/1/`` and ``/foo/23/`` will be cached separately, as you may expect. But once a particular URL (e.g., ``/foo/23/``) has been requested, subsequent requests to that URL will use the cache. +``cache_page`` can also take an optional keyword argument, ``key_prefix``, which +works in the same way as the ``CACHE_MIDDLEWARE_KEY_PREFIX`` setting for the +middleware. It can be used like this:: + + my_view = cache_page(my_view, 60 * 15, key_prefix="site1") + +Or, using Python 2.4's decorator syntax:: + + @cache_page(60 * 15, key_prefix="site1") + def my_view(request): + Specifying per-view cache in the URLconf ---------------------------------------- |
