Async Macro

Version 9.1 by Thomas Mortagne on 2019/12/10 17:17

cogAsynchronous and cached execution of wiki content.
TypeJAR
CategoryMacro
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU General Public License 1
Bundled With

XWiki Standard

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}}

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
asyncyestrue/falseyesEnable or disable asynchronous execution
cachedyestrue/falsefalseEnable or disable caching of the result of the macro content execution
contextyeslist 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).
idyeslistgenerated to be unique for each macro callA 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}}

Example 2:

{{async context="user"}}
{{velocity}}
Script that need the current user $xcontext.userReference
{{/velocity}}
{{/async}}

Prerequisites & Installation Instructions

Since XWiki 11.6.

Tags:
    

Get Connected