How to set cache meta data on drupalSettings? I use drupalSettings to send config data to javascript. But when I edit my config, the javascript object is not modified, I have to clear all cache to get the update.
The cache metadata in http headers show me that the page is linked to my 'config:my_module.settings' tag but the inline drupalSettings declaration is left unchanged.

What's the way to add cache metadata to:

$attachments['#attached']['drupalSettings']['example']['foo']
//or in hook_preprocess_hook ()
$variables['#attached']['drupalSettings']['example']['foo']


Or is there a function that could rebuild drupalSettings ?
When you add attachments you can add cache data as well: 

$attachments['#cache']['tags'][] = 'config:my_module.settings';


BTW #attached and #cache are the only data you are allowed to add in hook_page_attachments() or hook_page_attachments_alter().