Skip to content

Commit 06b5fe2

Browse files
committed
perf: use Stale-While-Revalidate
1 parent ea928d5 commit 06b5fe2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/pages/index.astro

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ import { getAnalyzedReleases } from "@/lib/db";
44
import Layout from "../layouts/Layout.astro";
55
66
const releases = await getAnalyzedReleases();
7+
8+
Astro.response.headers.set(
9+
"Cache-Control",
10+
"public, max-age=0, must-revalidate",
11+
);
12+
// We run a cron every 60 mins, so revalidate after 65 mins
13+
Astro.response.headers.set(
14+
"Netlify-CDN-Cache-Control",
15+
"public, max-age=3900, stale-while-revalidate=120",
16+
);
717
---
818

919
<Layout title="Next.js Sentinel">

0 commit comments

Comments
 (0)