Cache invalidation
Delivery caches rendered pages in memory and in Redis. The backend tells
delivery what to drop over the Redis pub/sub channel
scaicms:cache:invalidate. Both services must share the same Redis.
What invalidates automatically#
| Change | Clears |
|---|---|
| Content create, update, delete | That content's cached render |
| Content type change | Everything cached for the site, docs included |
| Template pack upload | The pack's templates and every content page on the site — not docs pages |
| Doc page create, update, delete | All cached docs renders |
| Site settings change | Everything for the site |
Messages are published by the backend directly when the change commits. The ARQ worker is not involved, so a stopped worker does not stop invalidation (it does stop search indexing).
"I changed content and the site is still stale"#
- Watch the channel. The Redis URL needs the ACL user, as in
REDIS_URL:Make the change. A JSON message should appear. None at all means the backend is pointed at a different Redis than delivery.scdoc1redis-cli -u "$REDIS_URL" SUBSCRIBE scaicms:cache:invalidate - Check what you are looking at. Docs responses carry an
ETagandCache-Control. Public pages for anonymous readers arepublic, max-age=60, so a browser or proxy may hold them for up to a minute. Restricted pages and anything rendered for a signed-in reader areprivate, no-store. Append?_nocache=1to bypass delivery's own cache for one request. - Flush by hand. The message must be JSON. A plain string such as
site:<id>:*is logged as invalid and ignored.Withcarbon1 2
redis-cli -u "$REDIS_URL" PUBLISH scaicms:cache:invalidate \ '{"type":"flush_all","site_id":"<site-id>"}'site_idthis clears that site's content, navigation, templates and docs renders. Without it, it flushes every site.
"I uploaded a new template pack and docs pages still use the old one"#
Expected: a pack upload clears content pages, not docs renders. Docs pages pick up the new templates after the flush above.
"I updated my JWT secret"#
JWTs from before the change are now invalid — delivery and backend both reject them. Sign out and sign back in.