summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_var.c
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2024-03-06 16:09:32 +0800
committerZhidao HONG <z.hong@f5.com>2024-03-08 17:47:11 +0800
commitf6899af68dcc5629b9a6d9b5ecfdd83a4a830ced (patch)
treed9c50847f3ff10c552bdbbe2c9830654c6193a3e /src/nxt_var.c
parent63bc388238c4dbdf533be5172012343d596ae794 (diff)
downloadunit-f6899af68dcc5629b9a6d9b5ecfdd83a4a830ced.tar.gz
unit-f6899af68dcc5629b9a6d9b5ecfdd83a4a830ced.tar.bz2
Var: Fix cacheable issue for njs variable access
The variables accessed with JS template literal should not be cacheable. Since it is parsed by njs engine, Unit can't create indexes on these variables for caching purpose. For example: { "format": "`{bodyLength:\"${vars.body_bytes_sent}\",status:\"${vars.status}\"}\n`" } The variables like the above are not cacheable. Closes: https://github.com/nginx/unit/issues/1169
Diffstat (limited to 'src/nxt_var.c')
-rw-r--r--src/nxt_var.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nxt_var.c b/src/nxt_var.c
index 2328d4ec..94d10cd8 100644
--- a/src/nxt_var.c
+++ b/src/nxt_var.c
@@ -147,7 +147,7 @@ nxt_var_ref_get(nxt_tstr_state_t *state, nxt_str_t *name, nxt_mp_t *mp)
if (decl != NULL) {
ref->handler = decl->handler;
- ref->cacheable = decl->cacheable;
+ ref->cacheable = (mp == state->pool) ? decl->cacheable : 0;
goto done;
}