Invalidate single block cache in D7 I have a custom site-wide block that shows on all pages, which I would like to be heavily cached for anon users but able to be invalidated when I modify its settings, or en/disable it (both drupal variables set in an admin page).

I've managed to achieve this pretty nicely in D8 with Cache::invalidateTags(), as well as some custom Acquia stuff to invalidate the varnish cache. However in trying to port this same functionality to a D7 site I've not managed to find any good method of doing it.

Any help much appreciated, thanks in advance!
You may have a look at Block Refresh, and implement your custom logic on top of it whenever you want to send a Cache-Control: max-age=0 :

//Override external cache max age if set
  if (isset($settings[$block_id]['bypass_external_cache']) &amp;&amp; $settings[$block_id]['bypass_external_cache'] != '') {
    drupal_add_http_header('Cache-Control', 'public, max-age=' . intval($settings[$block_id]['bypass_external_cache']));
  }