Django

Code

Show
Ignore:
Timestamp:
06/25/08 23:54:10 (4 months ago)
Author:
adrian
Message:

Fixed #6201 -- Improved the {% cache %} template tag to allow the timeout to be a template variable. Inspired by the patch by zz and edrik

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/cache.txt

    r7294 r7754  
    337337Simply pass as many arguments to ``{% cache %}`` as you need. 
    338338 
     339The cache timeout can be a template variable, as long as the template variable 
     340resolves to an integer value. For example, if the template variable 
     341``my_timeout`` is set to the value ``600``, then the following two examples are 
     342equivalent:: 
     343 
     344    {% cache 600 sidebar %} ... {% endcache %} 
     345    {% cache my_timeout sidebar %} ... {% endcache %} 
     346 
     347This feature is useful in avoiding repetition in templates. You can set the 
     348timeout in a variable, in one place, and just reuse that value. 
     349 
    339350The low-level cache API 
    340351=======================