Repository navigation
feat(cache): decouple cache storage from kv with cache config - #4709
Merged
Merged
Conversation
Add a `cache` config to choose the cache driver (`memory` (default), `fs` or `kv`) and set global cache options. A `cache` kv mount point keeps the `kv` driver for backward compatibility.
Keep global defaults for explicit `undefined` options, harden fs temp files, validate `cache` config, and fix docs placement and limits.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (16)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
pi0
approved these changes
Oct 3, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cached functions and handlers no longer use KV storage by default. A new
cacheconfig chooses the cache storage driver and sets global cache options.Drivers
memory(default): ocache's built-increateMemoryStorage, one LRU store shared by all caches.fs: one file per entry, built on ocache'screateBlobStorage(ocache has no fs driver yet). Node.js compatible runtimes only; Nitro warns on other presets. A relativedirresolves againstrootDirin dev and prerender, and against the working directory in production.kv: the previous behavior. Entries go throughuseKV()under thecache:prefix.Only the selected driver is bundled, via a new
#nitro/virtual/cachemodule.Backward compatibility
The default becomes
kvwhen acache,cache:*orcache/*KV mount point is configured (including$development/ deprecateddevStorage), so existing persistent cache setups keep working.These cases are not detected, and need
cache: { driver: "kv" }(documented in the cache docs and the migration guide):basepointing to another mount, for examplebase: "redis"useKV().mount(...)Global options (
cache.defaults)maxAge,swr,staleMaxAge,maxResolveTime,base) apply to cached functions, cached handlers and route rules.varies,allowQuery,allowCookies,allowAuthorization,sendCacheControl,cacheStatusHeader,maxBodySize) apply to handlers and route rules only.undefinedkeeps the global default.Notes
memoryandfsdeclarebinary, so binary bodies are stored as bytes instead of base64.memorydeclares a per-entry ceiling, somaxBodySizenow defaults to about 50 MB with that driver.🤖 Generated with AI assistant