Block cache depending on current node and its last modification time I am building a module with a block that outputs some informations from the current node.

When i return my render array i managed to get the cache as "node dependent" using (maybe not the best method ?) : 

        '#cache' =&gt; [
            'contexts' =&gt; [
                'url',
            ],
        ],


The blocks are showing up the right contents on the right pages, but if i modify my node and it's fields, the block content remains pulled from the cache and is not updated with the latest values.

Is there anything to add in the #cache array or a way to invalidate this specific cache when node gets updated ?
See my answer to a similar question here: Passing current node ID to the block template

In short, use the plugin context system to get the current node injected. It will automatically ensure that the right cache tags and contexts are added, based on where node is coming from.

Depending on what information you need exactly, you could also consider using the default entity view blocks provided by ctools. That allows you to view the node in a given view mode.