Commit bfd62a9
authored
Parallelize initial page cache population (#134)
* Add p-limit package
* Populate page-cache in parallel instead of sequentially
Previously, all routes were set one-by-one. Instead, up to `availableParallelism` pages are now concurrently read from the filesystem and populated into the cache handler.
* Introduced a promise-backed latch so cache setup runs once before potential parallel work
Added `#configureTask` alongside the existing merged handler state and wired a new `#ensureConfigured()` helper that guards the original configuration routine. The `get`, `set`, and `revalidateTag` entry points now await `#ensureConfigured()`, so they can be executed in parallel after the one-time initialization completes without racing the user-provided `onCreation` hook
* Allow customizing the parallelism factor1 parent 78a5f46 commit bfd62a9
File tree
4 files changed
+202
-78
lines changed- packages/nextjs-cache-handler
- src
- handlers
- instrumentation
4 files changed
+202
-78
lines changed
0 commit comments