Skip to content

Commit 4415d80

Browse files
committed
docs: improve the caching doc order
1 parent f789349 commit 4415d80

File tree

1 file changed

+5
-3
lines changed
  • packages/docs/src/routes/docs/(qwikcity)/caching

1 file changed

+5
-3
lines changed

packages/docs/src/routes/docs/(qwikcity)/caching/index.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export default component$(() => {
4747

4848
With the above setup, you will not only have better performance (pages are always served instantly from cache), but you can also have significantly decreased hosting costs, as our server or edge functions only need to run at most once every 5 seconds per page.
4949

50+
## `cacheControl`
51+
52+
Any method that takes a [request event](https://qwik.dev/docs/advanced/request-handling/#request-event) can call `request.cacheControl` to set the cache control headers for the response:
53+
5054
```tsx title="src/routes/layout.tsx"
5155
import type { RequestHandler } from "@builder.io/qwik-city";
5256

@@ -79,9 +83,7 @@ export const onGet: RequestHandler = async ({ cacheControl }) => {
7983

8084
You can see the full [API reference](https://qwik.dev/api/qwik-city-middleware-request-handler/) of options you can pass to `request.cacheControl`.
8185

82-
## `cacheControl` Order
83-
84-
Any method that takes a [request event](https://qwik.dev/docs/advanced/request-handling/#request-event) can call `request.cacheControl` to set the cache control headers for the response.
86+
### `cacheControl` Order
8587

8688
Qwik City executes request handlers in a specific order. This is important because if multiple handlers set the cache control policy, **the last one to execute wins**.
8789

0 commit comments

Comments
 (0)