Development

Block Caching “Gotcha” in Drupal 8

I recently had a fight with the Block system in Drupal 8. To be brief, if you’re trying to disable caching on a block, make sure to set the #cache element regardless of whether the block has output or not.

This does not work (empty result gets cached):

 

This does work (nothing gets cached, as desired):

 

Leave a Reply

Your email address will not be published.