On this page

Caches rendered data to improve page display performance.

Caches the rendered contents of the body of this macro. Very useful when using macros that might be slow to render content, but where it does not really need to be dynamically generated for each and every request. Specifically, this can improve performance for accessing dynamic data from SQLExcel, and similar macros. Cache will be refreshed if the body of the macro changes or if attachments to this page have been added, removed, or have newer versions. The cache applies to all users that view the page. The cached content can optionally be indexed for Confluence search.

User specific content

Do not use the cache macro around content that renders differently for different users. This is especially important for any content that is security sensitive.




Something to cache for a day
This will be cached for 30 minutes
{cache:refresh=2 hours}
The excel data will be cached for 2 hours
{cache:cron=30 * * * *|showRefresh=true|title=Refresh data from database}
This will be cached until 30 minutes past each hour of the day
select * from report
System.out.println("Hello world " + (new Date()) );

Advanced Examples

Tips and Techniques

Compatibility With Other Macros

See Interoperability

Cache Refresh

  • To force all cache macros on a page to refresh, use the refresh request attribute with value true
    • Example

  • To force a specific cache macros on a page to refresh, use refresh request attribute with value equal to the cache macro id. If not specified, it defaults to a sequence number based on position on page
    • Example