Skip to content

Extend the existing invalidate_cache() to plain edits #400

Description

@eyeseast

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions