Touch point: documentcloud/documents/models/document.py:704-747 and documentcloud/documents/views.py:1078-1082, views.py:1626-1627.
Good news: invalidate_cache() already exists and already purges both CloudFront and Cloudflare. The work is wiring, not building.
Today it's called only from destructive post-processing and redactions (the two views.py lines above). It is not called from:
perform_update / PATCH (title, description, metadata, data field edits).
_update_access (public → private flip, the one that most needs immediate cache invalidation for privacy reasons).
- Document deletion path.
- Slug changes (which change the canonical URL).
Action: add document.invalidate_cache() calls (or a Celery enqueue if it isn't already async) at each of these call sites. Without this, the tier table in (4) is unsafe — an edit on a 5-year-old doc would take up to a year to propagate.
This is the single change that unlocks the long TTLs in (4). Worth doing as a small standalone PR first; everything else can follow.
Touch point:
documentcloud/documents/models/document.py:704-747anddocumentcloud/documents/views.py:1078-1082,views.py:1626-1627.Good news:
invalidate_cache()already exists and already purges both CloudFront and Cloudflare. The work is wiring, not building.Today it's called only from destructive post-processing and redactions (the two
views.pylines above). It is not called from:perform_update/ PATCH (title, description, metadata,datafield edits)._update_access(public → private flip, the one that most needs immediate cache invalidation for privacy reasons).Action: add
document.invalidate_cache()calls (or a Celery enqueue if it isn't already async) at each of these call sites. Without this, the tier table in (4) is unsafe — an edit on a 5-year-old doc would take up to a year to propagate.This is the single change that unlocks the long TTLs in (4). Worth doing as a small standalone PR first; everything else can follow.