Cache resolved unit symbols per request

This commit is contained in:
udo
2026-07-16 18:14:23 +00:00
parent 197719ea23
commit ea89e3bb6d
5 changed files with 44 additions and 6 deletions
+2
View File
@@ -38,6 +38,7 @@ RENDER(Request& context)
ob_start();
component_render("components/panel:FOOTER", props, context);
String footer_markup = ob_get_close();
DValue perf = request_perf();
ob_start();
print("buffered-text");
@@ -54,6 +55,7 @@ RENDER(Request& context)
check("COMPONENT(Request& props) alias", alias_markup.find("alias=Component Output") != String::npos && alias_markup.find("body=This body comes from component()") != String::npos, alias_markup);
check("component_render() named handler", footer_markup.find("Named footer render") != String::npos, footer_markup);
check("component(\"unit:NAME\") named handler", header_markup.find("Component Output") != String::npos && header_markup.find("This body comes from component()") == String::npos, header_markup);
check("request-scoped unit symbol cache is activated", perf["unit_symbol_cache_hits"].to_u64() > 0 && perf["unit_symbol_lookups"].to_u64() >= perf["unit_symbol_cache_hits"].to_u64(), json_encode(perf));
check("ob_start() / ob_get_close()", buffer_markup == "buffered-text", buffer_markup);
?><div class="tests-section">