Skip to main content

prefetch_for_render

Function prefetch_for_render 

Source
pub async fn prefetch_for_render(
    pool: &Pool,
    locale_code: Option<&str>,
) -> HashMap<String, Value>
Expand description

Pre-fetch every site-setting row + group them into a scope → value_json map. Public-render installs this map in a thread-local that the site_setting(scope=…) Tera function reads. Bounded by the count of distinct scopes (typically tens), so one query per render covers every reference.

§Errors

None — failures degrade to an empty map; templates see Value::Null for every scope lookup.