static s64 demo_worker_init_count = 0; static s64 demo_component_hits = 0; INIT(Request& context) { (void)context; demo_worker_init_count += 1; } ONCE(Request& context) { context.call["once_hits"] = context.call["once_hits"].to_s64() + 1; } COMPONENT:PROBE(Request& context) { demo_component_hits += 1; <>
> } RENDER(Request& context) { DValue first; first["label"] = "First component call"; DValue second; second["label"] = "Second component call in the same request"; DValue third; third["label"] = "Third component call through unit_call(\"COMPONENT:PROBE\")"; <>This page calls the same named component twice. `ONCE()` should only run once for the request, while `INIT()` should stay stable for the currently loaded worker copy.
unit_call("once-init.uce", "COMPONENT:PROBE", &third); ?> > }