Cache Warm-Up Cron Job
Hit your most-visited pages every 10 minutes so the CDN edge cache stays warm and real users get instant responses.
*/10 * * * *
Every 10 minutes
Why warm the cache?
CDN caches and server-side caches expire after a TTL (time-to-live). When a cache entry expires, the next visitor to that page triggers a cache miss — the server has to regenerate the response, which can take 500ms–5s depending on your stack. If traffic is low, popular pages can go cold between visits.
A cache warm-up job pre-fetches your most important URLs on a regular interval, ensuring the cache is always populated before real users arrive.
Bash warm-up script
#!/bin/bash
URLS=(
"https://yoshi.tools/"
"https://yoshi.tools/guides/morning-brief.html"
"https://yoshi.tools/guides/database-backup.html"
"https://yoshi.tools/guides/weekly-report.html"
)
for url in "${URLS[@]}"; do
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$url")
echo "$(date -u) $STATUS $url"
done
Platform snippets
Standard crontab
*/10 * * * * /usr/local/bin/cache-warmup.sh >> /var/log/cache-warmup.log 2>&1
GitHub Actions
on:
schedule:
- cron: '*/10 * * * *'
jobs:
warmup:
runs-on: ubuntu-latest
steps:
- name: Warm cache
run: |
for url in \
"https://yoshi.tools/" \
"https://yoshi.tools/guides/morning-brief.html"; do
curl -s -o /dev/null "$url"
echo "Warmed: $url"
done
AWS EventBridge
# Note: EventBridge minimum interval is 1 minute cron(*/10 * * * ? *)
Vercel Cron (vercel.json)
{
"crons": [
{
"path": "/api/warmup",
"schedule": "*/10 * * * *"
}
]
}
Vercel / Next.js API route
// app/api/warmup/route.ts
export async function GET() {
const urls = [
process.env.NEXT_PUBLIC_URL + '/',
process.env.NEXT_PUBLIC_URL + '/guides/morning-brief.html',
]
await Promise.all(urls.map(url => fetch(url)))
return Response.json({ ok: true, warmed: urls.length })
}