Skip to content

User cache invalidation remediation #16937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Mar 21, 2025

Description

Previously, user caches have been invalidated whenever they:

  • are activated, unlocked, suspended, or unsuspended (52154d7)
  • attempt to login (48953f7)
  • are set to pending or inactive (2076b4e)

These were done specifically so user indexes show up-to-date information. However they also can end up inadvertently clearing front-end caches, if any user data is output within {% cache %} tags, or if the site has full-page caching that monitors all cache tag invalidations (like we do with Craft Cloud).

To fix, we’re now assigning element-index-query and element-index-query::<element-type> tags to element index query caches, and when any of the above actions occur, we are now only invalidating caches tagged with element-index-query::craft\elements\User.

(Normal user caches will still be cleared any time a user is fully saved.)

Related issues

Copy link

linear bot commented Mar 21, 2025

[ci skip]
@brandonkelly brandonkelly merged commit 28afaae into 4.15 Mar 22, 2025
@brandonkelly brandonkelly deleted the feature/cms-1380-user-cache-invalidation-remediation branch March 22, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants