-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: add staleIfError option for request.cacheControl, also adds docs on caching and caching to starters #4313
Conversation
Run & review this pull request in StackBlitz Codeflow. |
also added some caching default to our starters with links to docs |
```tsx title="src/routes/layout.tsx" | ||
import type { RequestHandler } from "@builder.io/qwik-city"; | ||
|
||
export const onGet: RequestHandler = async (request) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think use the destructured version of this, like
async ({ cacheControl }) =>
Technically the object is a RequestEvent, so I think naming it just a request
and setting response caching may be confusing in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah cool easy, on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated ✅
Overview
What is it?
Description
This is a really useful cache-control directive to avoid unnecessary downtime - allowing the CDN to serve stale responses when your origin is down
Also added a doc on caching, and added default caching to our starters
Checklist: