Repository navigation
design: invalidate cached pages from the admin, the CLI and the REST API - #4587
Conversation
|
|
On the open question "Should Editors be able to refresh a single path?": yes from us, and ideally "Refresh all pages" too. Our setup: we're moving from WordPress with Cloudflare APO to EmDash. Our content editors work as Editors. On WordPress they cleared stale pages themselves with the Cloudflare plugin's purge button, while IT typically used the Cloudflare account. On EmDash, after a fix that doesn't purge on its own (a byline or media change), our current workaround is an IT redeploy. In our testing, zone "Purge Everything" did not clear Workers Caching. Suggestion: a separate permission (for example |
Approval statusThe current revision meets the approval requirements.
This comment updates as reviews arrive. See MAINTAINING.md and the proposal process for the rules. |
|
Thanks a lot @wUEZRs for describing your setup, that's exactly the kind of use case this plan needs. I've kept this plan Admin-only for now, because #2021 asked for that and an Editor permission means a new permission and token scope in the auth package, plus some limit on how often the expensive "refresh all" request can run. I added your The "Also refresh pages tagged |
| ## Open questions | ||
|
|
||
| - Is 10 purge requests per call the right ceiling, or should the limit follow the provider? | ||
| - Should Editors be able to refresh a single path or all pages? This plan limits every action to Admins, as #2021 asks. A site moving from WordPress, where editors purged pages themselves, asked for a separate `cache:invalidate` permission granted to Editors. That needs a new permission and token scope in the auth package, and a limit on how often Editors can trigger the expensive "all" request, so it is left to a follow-up proposal. |
There was a problem hiding this comment.
Keep this to admins for now I think
Design proposal
Proposal: proposals/manual-cache-invalidation.md
Content written outside EmDash (for example
wrangler d1 execute --remote) leaves the route cache and object cache stale, and EmDash has no way to refresh them. On Cloudflare a zone purge doesn't reach Workers Cache, so site owners are left with a redeploy or a hand-written purge endpoint.This plan adds one admin-only route,
POST /_emdash/api/settings/cache/invalidate, plus anemdash cache invalidatecommand and a Cache settings page with "Refresh all pages" and "Refresh a path". Targets are entries, paths, tags, or all EmDash content. Route-cache invalidation goes only through Astro'scache.invalidate(), so core gets no Cloudflare-specific code. The route reuses the existingsettings:managepermission and token scope, so the auth package doesn't change.Proposal type
Related work
Discussion: #2021
Readiness
accepted(check only when ready to merge)AI assistance