Commit c200d7a
committed
feat(core): run the cache in a dedicated handler function
Add a standalone cache handler function that owns the incremental cache, the
tag cache and CDN invalidation, and a `cache` override that other functions use
to reach it.
- `adapters/cache-adapter.ts` exposes `GET/PUT/DELETE /cache/*` and
`POST /cache/revalidate-tags` through `createGenericHandler`.
- `build/createCacheBundle.ts` bundles it to `.open-next/cache-function`, wired
into `buildAdapter` behind the new `skipCache` option and reported as
`cacheFunction` in the OpenNext output.
- New top level `cacheHandler` config option carries the incremental cache, tag
cache and cdn invalidation overrides for that function.
- New `cache` override with `fetch`, `local` and `dummy` implementations, and a
shared wire format in `utils/cache-get.ts` that splits the entry metadata into
headers and the payload into the body.
Nothing is removed here: the existing in-process `incrementalCache` and
`tagCache` overrides keep working unchanged.1 parent cd8f83e commit c200d7a
21 files changed
Lines changed: 1811 additions & 8 deletions
File tree
- .changeset
- packages
- core/src
- adapters
- build
- core
- overrides/cache
- plugins
- types
- utils
- tests-unit/tests
- overrides/cache
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
0 commit comments