Skip to content

User cache invalidation remediation#16937

Merged
brandonkelly merged 2 commits into4.15from
feature/cms-1380-user-cache-invalidation-remediation
Mar 22, 2025
Merged

User cache invalidation remediation#16937
brandonkelly merged 2 commits into4.15from
feature/cms-1380-user-cache-invalidation-remediation

Conversation

@brandonkelly
Copy link
Copy Markdown
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

@linear
Copy link
Copy Markdown

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