Cache Macro
Version 5.1 by Thomas Mortagne on 2011/10/27 18:12
Cache the content of the macro for some time |
Type | javamacro |
Category | |
Developed by | Unknown |
Rating | |
License | Unknown |
Table of contents
Description
Usage
{{cache}}
content to cache here...
{{/cache}}
content to cache here...
{{/cache}}
It's possible to pass an optional id parameter which to use to cache the content. If not defined then the macro will use the content itself as the id. However this doesn't guarantee unicity since the same content could be located on several pages with different results. Also note that the id can contain wiki syntax; this is done so that the user can use script macros to generate the id.
Examples
Force the usage of an id:
{{cache id="myuniqueid"}}
content to cache here...
{{/cache}}
content to cache here...
{{/cache}}
Compute the id based on some script evaluation:
{{velocity}}
#set ($myid="somecomputeduniqueid")
{{/velocity}}
{{cache id="~{~{velocity~}~}$myid~{~{/velocity~}~}"}}
content to cache here...
{{/cache}}
#set ($myid="somecomputeduniqueid")
{{/velocity}}
{{cache id="~{~{velocity~}~}$myid~{~{/velocity~}~}"}}
content to cache here...
{{/cache}}
Compute the id based on some URL parameter:
{{cache id="~{~{velocity~}~}$request.id~{~{/velocity~}~}"}}
content to cache here...
{{/cache}}
content to cache here...
{{/cache}}