mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #653] [CLOSED] feat: lazy per-route cache seeding for Workers #746
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#746
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/653
Author: @NathanDrake2406
Created: 3/22/2026
Status: ❌ Closed
Base:
main← Head:feat/seed-workers-memory-cache📝 Commits (6)
97c7a82feat: lazy per-route cache seeding for Workers from prerendered assets8011d47refactor: extract shared types and helpers from seed-cache modules8f46d7ffix: error resilience and transient failure recovery in Workers cache seedingee4f85bfix: resolve merge conflicts and address review commentsb995b0dfix: harden workers prerender cache seeding path normalization7ec76affix: cache permanent manifest parse failures in workers seeding📊 Changes
7 files changed (+889 additions, -61 deletions)
View changed files
📝
packages/vinext/package.json(+4 -0)📝
packages/vinext/src/deploy.ts(+61 -13)➕
packages/vinext/src/server/seed-cache-shared.ts(+60 -0)➕
packages/vinext/src/server/seed-cache-workers.ts(+229 -0)📝
packages/vinext/src/server/seed-cache.ts(+17 -48)📝
tests/deploy.test.ts(+45 -0)➕
tests/seed-cache-workers.test.ts(+473 -0)📄 Description
Summary
MemoryCacheHandler(the default when KV is not configured), pre-rendered routes now lazily seed the memory cache on first request viaenv.ASSETS.fetch()Pre-requisite
Depends on #645 for the manifest format changes (
buildId,router,trailingSlashfields).How it works
deploy.ts): After prerendering, copiesvinext-prerender.jsonand HTML/RSC files todist/client/__prerender/so they're deployed as static assetsseed-cache-workers.ts): On each request, checks if the route has prerendered data. On first miss, fetches HTML/RSC from the assets binding and populatesMemoryCacheHandler. Subsequent requests in the same isolate get cache HITsseedRouteFromAssets()before delegating to the RSC handlerChanges
src/server/seed-cache-workers.tssrc/deploy.tspackage.json./server/seed-cache-workerstests/seed-cache-workers.test.tsScope
This is Workers memory stub support only, not the final durable caching story. For persistent caching, users should use
KVCacheHandler(opt-in) with TPR for deploy-time KV population. Issue #562 tracks the generalised remote cache seeding.Ref #561
Test plan
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.