Cache Macro - 7.x
Summary
Cache macro caches rendered data to improve page display performance.
This macro caches the rendered contents of its body. This is 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 SQL, Excel, and similar macros. Cache is refreshed when the body of the macro changes or attachments to this page are 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.
Parameters
Customization
See New Cache Management Options.
Usage
{cache} Something to cache for a day {cache}
{cache:refresh=30m} This will be cached for 30 minutes {cache}
{cache:refresh=2 hours} The excel data will be cached for 2 hours {excel:file=^Report.xls} {cache}
{cache:cron=30 * * * *|showRefresh=true|title=Refresh data from database} This will be cached until 30 minutes past each hour of the day {sql:dataSource=ReportDS} select * from report {sql} {cache}
{cache:refresh=1d|showRefresh=true|showDate=true} {beanshell} System.out.println("Hello world " + (new Date()) ); {beanshell} {cache}
Advanced examples
Tips and techniques
Refer to the Page display performance tips and techniques article.
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
From version 7.9.3, all Cache macros on all pages can be refreshed at the same time with the Expire cache parameter in the app's Configuration page. Contact your administrator to force the refresh for all pages and to know more, refer to the Configuration page.
Example
http://localhost/display/DEMO/test?refresh=true
- To force a specific Cache macro 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
http://localhost/display/DEMO/test?refresh=1 http://localhost/display/DEMO/test?refresh=myId
Confluence®, Jira®, Atlassian Bamboo®, Bitbucket®, Fisheye®, and Atlassian Crucible® are registered trademarks of Atlassian®
Copyright © 2005 - 2024 Appfire | All rights reserved. Appfire™, the 'Apps for makers™' slogan and Bob Swift Atlassian Apps™ are all trademarks of Appfire Technologies, LLC.