Deprecate CacheBackendInterface::invalidateAll()

Created on 11 January 2025, 11 days ago

Problem/Motivation

We have exactly one valid use case for invalidating a specific item in core vs delete (CacheCollector), but I don't see a use case for invalidateAll(). There is \Drupal\system\Entity\Menu::save(), but IMHO, it's mostly a naming problem because you invalidate the cache. But really you should use deleteAll() in that case IMHO, which actually deletes the entries (in the database implementation. redis is another special thing).

Quite a lot of calls in contrib (https://git.drupalcode.org/search?group_id=2&scope=blobs&search=%22-%3Ei...), most of those are just flat out wrong (cache.render invalidate all should really invalidate the rendered cache tag, that won't work for page cache and dynamic page cache)

Reason: It's an expensive thing for redis and I guess also memcache to support, because redis implements it as an extra cache tag. See πŸ“Œ Optimize bin cache tags and last write timetamp Active as a related issue.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

cache system

Created by

πŸ‡¨πŸ‡­Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @berdir
  • Merge request !10876deprecate invalidateAll() β†’ (Open) created by berdir
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    Created a basic merge request, will need an update with the change record if others agree.

  • Pipeline finished with Failed
    10 days ago
    Total: 99s
    #393158
  • Pipeline finished with Running
    10 days ago
    #393184
  • Pipeline finished with Failed
    10 days ago
    Total: 103s
    #393452
  • Pipeline finished with Failed
    10 days ago
    Total: 505s
    #393477
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Can we add a CR for the deprecations and update the messages to use that link vs the issue. Since there is a replacement I'm a big fan of before/after snippets

  • Pipeline finished with Failed
    4 days ago
    Total: 185s
    #399173
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    I tend to start off without to get early feedback. But I'm also aware that helps with explaining the reason, created one now.

  • Pipeline finished with Failed
    3 days ago
    Total: 6389s
    #399675
  • Pipeline finished with Success
    2 days ago
    Total: 513s
    #400314
Production build 0.71.5 2024