Skip to content

src, scripts: better directory cache - #1068

Merged
flakey5 merged 1 commit into
mainfrom
flakey5/20261024/cache
Nov 10, 2026
Merged

flakey5 merged 1 commit into
mainfrom
flakey5/20261024/cache

Conversation

@flakey5

@flakey5 flakey5 commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Changes the way the KV directory cache works:

scripts/handle-mainline-release.mjs is triggered by the update links action. Updates the cache entries for the directories that have symlinks. Doesn't add the cache entry for the new released version anymore.

When KV listings are enabled, we try fetching the directory from the KV directory cache like usual. If the directory isn't found however, then we fall back to R2. If R2 has the directory, then we return that result and then cache the R2 result in the KV cache for however long CACHE_KV_TTL is (currently an arbitary 6 hours).

This is 1/2 mrs for this, with the second being a follow up to move us back to using R2's bindings api for uncached directory listings instead of the S3 api.

Fixes #1034

@flakey5
flakey5 requested a review from a team as a code owner October 25, 2026 06:11
@flakey5
flakey5 force-pushed the flakey5/20261024/cache branch from 1780c66 to 623c576 Compare October 25, 2026 06:16
Comment thread src/middleware/r2Middleware.ts Resolved
@flakey5
flakey5 force-pushed the flakey5/20261024/cache branch from 4ff2b1e to 7127863 Compare October 28, 2026 04:57
@MikeMcC399

Copy link
Copy Markdown

This PR has conflicts that need resolving

Comment thread e2e-tests/directory.kv.test.ts Fixed
@flakey5
flakey5 force-pushed the flakey5/20261024/cache branch from bea65bd to c4f8a76 Compare November 10, 2026 22:37
Changes the way the KV directory cache works:

`scripts/handle-mainline-release.mjs` is triggered by the update
links action. Updates the cache entries for the directories that have
symlinks. Doesn't add the cache entry for the new released version
anymore.

When KV listings are enabled, we try fetching the directory from the KV
directory cache like usual. If the directory isn't found however, then
we fall back to R2. If R2 has the directory, then we return that result
and then cache the R2 result in the KV cache for however long
`CACHE_KV_TTL` is (currently an arbitary 6 hours).

Fixes #1034

Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com>
@flakey5
flakey5 force-pushed the flakey5/20261024/cache branch from c4f8a76 to fab8018 Compare November 10, 2026 22:45
@flakey5
flakey5 merged commit dbee77f into main Nov 10, 2026
8 checks passed
@flakey5
flakey5 deleted the flakey5/20261024/cache branch November 10, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v27 nightly releases after 2026-09-07 missing from https://nodejs.org/download/nightly/ directory

3 participants