Problem/Motivation

CloudFront only stores the first 50 cache tags per cached object. When a response has more than 50 tags, CloudFront silently drops the excess. This means content associated with dropped tags won't be invalidated when those tags are purged.

Currently, tags are sent in whatever order Drupal provides them, with no control over which tags are prioritized when exceeding the limit.

Steps to reproduce

Proposed resolution

Introduce two swappable services for tag processing:

  • CacheTagFilterInterface - Filters tags before they're added to the header. Default implementation uses the Purge blocklist.
  • CacheTagPrioritizerInterface - Sorts tags so the most valuable are sent first. Default implementation prioritizes: entity tags (e.g., node:123) → list tags (e.g., node_list) → other tags.

Entity tags are prioritized because they enable precise invalidation of specific content. List tags trigger broader invalidations and can be handled with shorter TTLs or path-based invalidation as a fallback.

Sites can override either service to implement custom filtering or prioritization strategies.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kim.pepper created an issue. See original summary.

kim.pepper changed the visibility of the branch 3589395-add-swappable-cache to hidden.

kim.pepper’s picture

Status: Active » Needs review

  • kim.pepper committed baf7a355 on 2.x
    feat: #3589395 Add swappable cache tag filter and prioritizer services...
kim.pepper’s picture

Status: Needs review » Fixed

Committed to 2.x

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.