Add CacheOptionalInterface to more blocks

Created on 28 March 2025, 5 days ago

Problem/Motivation

📌 Make language switcher block cacheable Postponed introduces support for blocks to implement said interface, in that issue just for the language switcher.

I think there are a number of blocks that could benefit from this as well, where we can safely assume that rendering them is faster than fetching it from the cache backend.

Essentially blocks that just render out straight markup, with minimal to no theming and no IO.

Such as \Drupal\system\Plugin\Block\SystemPoweredByBlock and \Drupal\system\Plugin\Block\SystemMessagesBlock probably as well.

This is similar to #2935804: Add cache context exclusion list to RenderCache::set() except it's not cache context based but more explicit.

Proposed resolution

Add the interface.

Remaining tasks

Figure out how to decide to which blocks we want to add it.

User interface changes

None.

API changes

📌 Task
Status

Needs review

Version

11.0 🔥

Component

language system

Created by

🇨🇭Switzerland berdir Switzerland

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

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

  • Performance

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

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024