I want to execute code before cache is cleared, for example for the menu cache:
// Clear menu cache
$cache = \Drupal::cache('menu');
$cache->deleteAll();
I want to intervene when the cache clear is called, right before it is deleted. I've read the documentation on Drupal::cache and the Cache API but didn't find a solution. Do note that I want to do this using core code only, no contributed modules.
::deleteAll
or::deleteMultiple
which is where it would need to happenstandard.links.menu.yml
and adding it withMenuLinkContent::create()
instead. And now we need an upgrade path.