diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2008-06-26 04:54:10 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2008-06-26 04:54:10 +0000 |
| commit | 74f0408fa2e8e41969a381150f6d78d0cdf3f363 (patch) | |
| tree | 149bc5b5f97f4a7ca35429f6560e08dc1507a82c /docs | |
| parent | 5ee4a099f1554a60ecb6a525e33044c38a1206fe (diff) | |
Fixed #6201 -- Improved the {% cache %} template tag to allow the timeout to be a template variable. Inspired by the patch by zz and edrik
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7754 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/cache.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/cache.txt b/docs/cache.txt index e7e1cdd791..3318b2ad4a 100644 --- a/docs/cache.txt +++ b/docs/cache.txt @@ -336,6 +336,17 @@ template tag to uniquely identify the cache fragment:: It's perfectly fine to specify more than one argument to identify the fragment. Simply pass as many arguments to ``{% cache %}`` as you need. +The cache timeout can be a template variable, as long as the template variable +resolves to an integer value. For example, if the template variable +``my_timeout`` is set to the value ``600``, then the following two examples are +equivalent:: + + {% cache 600 sidebar %} ... {% endcache %} + {% cache my_timeout sidebar %} ... {% endcache %} + +This feature is useful in avoiding repetition in templates. You can set the +timeout in a variable, in one place, and just reuse that value. + The low-level cache API ======================= |
