...
On this page
Table of Contents |
---|
maxLevel | 1 |
---|
exclude | On this page |
---|
type | flat |
---|
separator | pipe |
---|
|
Section |
---|
Column |
---|
Excerpt |
---|
SummaryCaches Cache macro caches rendered data to improve page display performance. |
Caches This macro caches the rendered contents of the its body of this macro. Very . 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 will be is refreshed if when the body of the macro changes or if attachments to this page have been 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. Warning |
---|
title | User specific content |
---|
| Do not use the cache Cache macro around content that renders differently for different users. This is especially important for any content that is security sensitive. |
|
Column |
---|
|
|
|
Parameters
Table plus |
---|
Parameter | Default | Macro Browser Label | Description |
---|
id | automatically generated | Reference id | Defaults to an automatically generated sequence number. The id must be unique on the page. Specifying the id can improve performance during edit by reducing cache refreshes during macro browser refresh, preview, and save cycle. It also helps when re-ordering cache macros on a page. The can be used when doing cache macro specific refreshes - see Cache Refresh below. Since 5.1.0. | refresh | 1d (one day) | Cache refresh period | | will be isrefreshed the next time page is viewed after the refresh period. | A will be is treated as seconds. A number followed by one of the following characters | will be istreated as follows: - s - seconds.
- m - minutes.
- h - hours.
d- days. Note |
---|
Any data after a s, m, h, or d is ignored. For example, 10days is the same as 10d or 10 days. |
| cron |
| Cron expression | Cron-like expression for finer grained cache expiration and refresh. See Cron Expressions. For example: 30 * * * * - cache | will expire expires30 minutes past each hour of the day. | This means the data shown will
| checkAttachments | true | Check attachments | If true, the cache | will be is refreshed if there is any change in the attachments on this page. This includes adding, removing, or changing the version of any attachment. For instance, if you are caching the rendering of the an excel spreadsheet, then the data | will be refresh is refreshed if the attached spreadsheet is updated. | showRefresh | false | Show refresh icon | When shown, the icon can be clicked to cause the immediate refresh of the data. | showDate | false | Show date | Show the date and time of data was last generated. See also dateFormat. | index | false | Index content | Add cached content to the Confluence search index. Whenever the cached data is updated, the page | will be is re-indexed. This enables external content to be found using Confluence search. | title | Refresh | Title | Title to show when mouse is over the refresh icon. | dateFormat | user date format | Date format | Defaults to the system defined format modified by the | users user's time zone. The refresh date can be have a specific format. Use a simple date format string. Since 6.1. | anchor |
| Anchor | Name of a page anchor used to position after refresh link is pressed. Use @default to have an anchor generated at the macro location. Since 6.7. | retry | Default | Retry feature | Special handling for render errors that can be retried. See Retry Feature for more details. Since 6.8. |
|
Customization
See New Cache Management Options.
Usage
No Format |
---|
{cache}
Something to cache for a day
{cache}
|
...
No Format |
---|
{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 Cache macros on a page to refresh, use the refresh request attribute with value
truetrue
Info |
---|
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
No Format |
---|
http://localhost/display/DEMO/test?refresh=true
|
- To force a specific cache macros 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
No Format |
---|
http://localhost/display/DEMO/test?refresh=1
http://localhost/display/DEMO/test?refresh=myId |