Skip to content

docs: add caching guide - #3251

Merged
james-elicx merged 3 commits into
mainfrom
codex/caching-docs
Sep 14, 2026
Merged

docs: add caching guide#3251
james-elicx merged 3 commits into
mainfrom
codex/caching-docs

Conversation

@james-elicx

Copy link
Copy Markdown
Member

Summary

  • explain vinext response and data caching
  • compare Workers Response Store, Workers Cache with KV, KV-only, and uncached setups
  • document warming, regional cache behavior, revalidation, and deployment choices
  • link the guide near the top of the README

Testing

  • vp fmt --check README.md docs/caching.md

@pkg-pr-new

pkg-pr-new Bot commented Sep 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vinext/cloudflare

npm i https://pkg.pr.new/cloudflare/vinext/@vinext/cloudflare@3251

create-vinext-app

npm i https://pkg.pr.new/cloudflare/vinext/create-vinext-app@3251

@vinext/types

npm i https://pkg.pr.new/cloudflare/vinext/@vinext/types@3251

vinext

npm i https://pkg.pr.new/cloudflare/vinext@3251

@cloudflare/workers-response-store

npm i https://pkg.pr.new/cloudflare/vinext/@cloudflare/workers-response-store@3251

commit: 96f78a2

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
response-store-demo preview production
static-export preview production
web preview production

@github-actions

github-actions Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared 96f78a2 against base 8eccc20 using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 0 regressed · 6 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.2 KB 142.2 KB ⚫ -0.0%
Client entry size (gzip) vinext 129.6 KB 129.6 KB ⚫ -0.0%
Dev server cold start vinext 2.57 s 2.57 s ⚫ -0.1%
Production build time vinext 2.71 s 2.68 s ⚫ -1.0%
RSC entry closure size (gzip) vinext 125.8 KB 125.8 KB ⚫ -0.0%
Server bundle size (gzip) vinext 216.5 KB 216.5 KB ⚫ -0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Please complete the review within 8 minutes.

Comment thread docs/caching.md Outdated

| Setup | Response storage | Data storage | Best for | Main trade-off |
| ------------------------------------ | -------------------------- | ---------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| No persistent cache | None | None | Dynamic apps and initial migrations | Every request may need to render and fetch its data |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The no-adapter setup still uses the default MemoryCacheHandler (50 MiB per isolate unless cacheMaxMemorySize changes it) for both data and origin-managed ISR responses. Labeling both stores as None makes this setup sound fully uncached; please describe the per-isolate memory cache and its lack of shared persistence instead.

Comment thread docs/caching.md
| Workers Cache + data cache | Workers Cache | Workers KV | Fast edge responses using Cloudflare's native caches | Cached responses have no durable backing store, and a hit in one region does not guarantee a hit elsewhere |
| Data cache | Workers KV | Workers KV | A simple persistent cache without Workers Cache | Requests still reach the Worker and KV is eventually consistent |

When caching is enabled through `vinext init`, Workers Response Store is the default choice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the current vinext init behavior. The initializer only offers workers-cache or data-cache for the CDN cache and kv or none for data, defaulting to Workers Cache plus KV (init-platform.ts). It cannot select responseStoreAdapter() at all. Please remove this claim (and the corresponding “these choices” claim near the end) or add initializer support first.

Comment thread docs/caching.md
vinext({ cache: responseStoreAdapter() });
```

The default service-binding mode keeps the cache service in a separate Worker. `vinext init` creates `wrangler.response-store.jsonc` alongside the application config and adds a deployment script:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vinext init does not create either wrangler.response-store.jsonc or a deploy:response-store script; these names occur nowhere in the implementation. Service-binding mode currently requires a separately configured cache Worker plus the application Worker RESPONSE_STORE and version-metadata bindings. As written, readers following this guide will have neither the referenced script nor the required bindings, so this section needs the actual manual setup or initializer support.

@ask-bonk

ask-bonk Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Submitted 3 actionable inline findings.

github run

@james-elicx
james-elicx marked this pull request as ready for review September 14, 2026 17:16
@james-elicx
james-elicx merged commit cdcffea into main Sep 14, 2026
127 of 129 checks passed
@james-elicx
james-elicx deleted the codex/caching-docs branch September 14, 2026 18:38
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.

1 participant