{nocache:level}

Description

Turns off AA caching while a template renders. AA caches in two places - a page cache (the whole rendered page) and an internal stringexpand cache (the result of expanding aa-expressions). nocache returns nothing visible; it only flips cache switches as a side effect. The level argument is a bitfield - 1 turns off the page cache for the current page, 2 turns off the internal stringexpand cache, 3 turns off both. With no argument nocache behaves as level 2. The typical use is at the top of an email or notification template whose parameters are supplied by define, where a stale cached expansion would be wrong. nocache itself is never cached.

Parameters

level optional default 2

Bitfield selecting which caches to disable. Add the values to combine them: 1 turns off the page cache for the current page, 2 turns off the internal stringexpand cache, 3 turns off both. Other values follow the same bit logic but only bits 1 and 2 are meaningful.

Examples

test[{nocache}]
Expected[]
Actual[]
With no level, nocache stops only the internal stringexpand cache (the same as level 2) and outputs nothing. The brackets here are literal; they just make the empty output visible.
test{nocache:3}{define:nctestuser:Jana}Hello {var:nctestuser}
ExpectedHello Jana
ActualHello Jana
The canonical use - put nocache at the very top of an email or notification template whose values arrive through define, so a previously cached expansion is not reused. nocache prints nothing; the define and var produce the visible text.
test[{nocache:1}]
Expected[]
Actual[]
Level 1 stops the page cache for the current page so the rendered page is not stored. Output is still empty.
test[{nocache:2}]
Expected[]
Actual[]
Level 2 stops the internal stringexpand cache (the result of expanding aa-expressions). This is what a bare nocache does.
test[{nocache:3}]
Expected[]
Actual[]
Level 3 is the bitfield 1+2, so it stops both the page cache and the stringexpand cache at once.