Async Macro
Version 9.1 by Thomas Mortagne on 2019/12/10 17:17
Asynchronous and cached execution of wiki content. |
Type | JAR |
Category | Macro |
Developed by | |
Rating | |
License | GNU General Public License 1 |
Bundled With | XWiki Standard |
Table of contents
Description
This macro provide an easy way to execute asynchronously and/or cached wiki content.
Usage
From Wiki Syntax
{{async async="false" cached="true" context="user,doc.reference"}}
content
{{/async}}
content
{{/async}}
Parameters definition
Name | Optional | Allowed values | Default value | Description |
---|---|---|---|---|
async | yes | true/false | yes | Enable or disable asynchronous execution |
cached | yes | true/false | false | Enable or disable caching of the result of the macro content execution |
context | yes | list | The list of context elements needed for the execution (wiki, user, locale, request.base, doc.reference...). By default no specific information from the context is provided (even if there is a usable context provided to manipulate API which need one). | |
id | yes | list | generated to be unique for each macro call | A unique id is automatically generated by default (based on the location of the macro) but it's possible to provide a custom one if needed (for example to share the result of an sync block between two different pages). |
Example
Example 1:
{{async}}
{{velocity}}
Some slow script.
{{/velocity}}
{{/async}}
{{velocity}}
Some slow script.
{{/velocity}}
{{/async}}
Example 2:
{{async context="user"}}
{{velocity}}
Script that need the current user $xcontext.userReference
{{/velocity}}
{{/async}}
{{velocity}}
Script that need the current user $xcontext.userReference
{{/velocity}}
{{/async}}
Prerequisites & Installation Instructions
Since XWiki 11.6.