Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(cache): make default value swr: true more clear #1949

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/1.guide/5.cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ Cache a route with [stale-while-revalidate](https://www.rfc-editor.org/rfc/rfc58
export default cachedEventHandler(async () => {
return `Response generated at ${new Date().toISOString()}`;
}, {
swr: true, maxAge: 10
maxAge: 10
});
```

The response will be cached for 10 second and a stale value will be sent to the client while the cache is being updated in the background.
The response will be cached for 10 seconds and a stale value will be sent to the client while the cache is being updated in the background. If you want to immediately return the updated response set `swr: false`.

The cached answer will be store in development inside `.nitro/cache/handlers/_/*.json`.

Expand Down