]> git.kaiwu.me - njs.git/commit
Modules: treat expired shared dict entries as absent
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 10 Oct 2026 01:54:41 +0000 (18:54 -0700)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 15 Oct 2026 01:49:05 +0000 (18:49 -0700)
commit28977360766a96d183c61075a680ea527f44a598
tree81d479c74d10240091ead47ac70d614f0ebdb713
parentaeef0bfe283032d0a66d5299472c75407b9a6073
Modules: treat expired shared dict entries as absent

Expired entries are hidden by read APIs but can still be found by
write operations.  replace() can revive an expired entry, delete()
can report that it existed, and incr() can use its old value instead
of init.  Without an explicit timeout, incr() can return a value that
a subsequent get() cannot retrieve.

Use a common write-side lookup to remove expired entries and handle
them as missing in both engines.  incr() then creates a new entry
with init plus delta and the directive or explicit timeout.

Also return false instead of undefined when QuickJS delete() is
called for a missing key.
nginx/ngx_js_shared_dict.c
nginx/t/js_shared_dict.t