Use events to flush all caches on container rebuild

Created on 21 July 2023, over 1 year ago

Problem/Motivation

Currently, container rebuild and flushing all caches is done with procedural functions
drupal_rebuild(), drupal_flush_all_caches(), _drupal_flush_css_js().

In πŸ“Œ Convert drupal_rebuild() and drupal_flush_all_caches() functions into cache Rebuilder class Needs work it is being proposed to convert these to a cache rebuilder class.
However, this still leaves a hard-coded piece of code to do all the tasks needed on container rebuild.

As an alternative, I propose to introduce events to decentralize these tasks.
(in fact this is not mutually exclusive with the cache rebuilder class)

Steps to reproduce

Proposed resolution

Introduce one event for "container rebuilt".
Introduce another event for "all caches should be cleared".
Add a subscriber for "container rebuilt" that triggers the "all caches should be cleared" event.
Let different services subscribe to these events.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 9 hours ago

Created by

πŸ‡©πŸ‡ͺGermany donquixote

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @donquixote
  • Open on Drupal.org β†’
    Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    Not currently mergeable.
  • @donquixote opened merge request.
  • πŸ‡©πŸ‡ͺGermany donquixote

    Actually the hard-coded version as in drupal_flush_all_caches() has one advantage:
    The order is fully predictable, without using weights.

    Let's go ahead splitting it up, and see later how we like it.

Production build 0.71.5 2024