cache queries and revalidate with incremental static regeneration
This commit is contained in:
@@ -34,3 +34,18 @@ npm run build
|
||||
prek install # registers the git hook
|
||||
prek run --all-files # run on everything
|
||||
```
|
||||
|
||||
## Caching and revalidation
|
||||
|
||||
The frontend caches all pages and GraphQL responses (ISR) under a single `cms` cache tag.
|
||||
Wagtail purges it via a webhook on any publish/unpublish/move/delete (see `dnscms/dnscms/revalidation.py`).
|
||||
Date-sensitive queries (`futureEvents`, opening hours) additionally expire at Oslo midnight.
|
||||
`REVALIDATE_WEBHOOK_SECRET` must be set to the same value on both sides
|
||||
(`web/.env.local` and `dnscms/dnscms/settings/local.py` or env); unset disables the webhook.
|
||||
|
||||
```bash
|
||||
# manual purge
|
||||
curl -X POST -H "X-Revalidate-Secret: $SECRET" https://<frontend>/api/revalidate
|
||||
```
|
||||
|
||||
Note: ISR is off under `npm run dev`; use `npm run build && npm run start` to test caching.
|
||||
|
||||
Reference in New Issue
Block a user