Cache Exclude functionality in Drupal 8 How can I prevent a specific node - or a list of specific nodes - being cached server-side in Drupal 8?

I have page that pulls a value out of a $_SESSION variable using a PHP text block, and it is being cached, which is obviously not what I want.
I fixed this by doing the following:


I appended a cache buster querystring parameter to the link to the page that needed to be kept out of cache (using the timestamp token + random number token)
Added the 'url.query_args' cache context to the required_cache_contexts in services.yml


It puts a bit more strain on the memory use of the cache than just keeping it out of cache altogether, but the \Drupal::service('page_cache_kill_switch')-&gt;trigger(); line did not do anything for me at all.

I think it makes sense for the querystring to be part of the default cache context anyway.