I have followed all the instructions here https://www.drupal.org/node/2598914

I'm developing a module with a block, and when I went to the Block Layout page and clicked "Place Block", the list of blocks did not come up due to an error in my code. I edited the code and was sure it was correct, yet it still didn't work. So I tried doing "drush cr" just in case the cache wasn't really disabled ... and that made it work.

So it seems to me that the cache has not been disabled by following those instructions. Is there something missing?

Edit: This has happened again when I have made new changes, even after the plugin has successfully loaded. It happens when when I make any changes to src/Plugin/Derivative/Foo.php (inside my module). Those changes aren't picked up until I manually cache rebuild


1 Answer 1


You've disabled the render, dynamic_page_cache, and page cache bins; plugin discovery is stored in a different bin (discovery). You probably don't want to disable that bin, as it's likely to slow the site down appreciably (the project will be scanned for plugins on every request).

If you just keep in mind that you need to rebuild caches manually when you add a plugin, implement a hook, or add/change a .yml file in the module's root, you'll be able to work a lot faster.

  • Thanks. I've since worked out that the time I need to manually rebuild it is when I make a change to src/Plugin/Derivative/Foo.php. So it is not one of the scenarios you mention. Is that also to be expected do you think?
    – naomi
    Sep 16, 2019 at 20:01
  • In principle no, but it's difficult to say without more context. I should have mentioned those scenarios are probably just the most common, cache can be complicated. What are you changing in the derivative class that needs a cache clear afterwards?
    – Clive
    Sep 16, 2019 at 20:18
  • 1
    Plugin derivatives need a rebuilt of the plugin cache, too. You can instruct the plugin manager of that specific plugin type to do this, if you don't want to clear all caches and so save some cpu cycles: \Drupal::service('plugin.manager.block')->clearCachedDefinitions();, which is by the way what core does when saving a custom block to update the block plugin definitions derived from the database content.
    – 4uk4
    Sep 16, 2019 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.