Looking to be able to add some cache tags to large sets of pages (or even all pages) on the site to invalidate the cached content in Pantheon’s CDN/Varnish. Since there is no API command in code to run the clear caches operation, this seems to be the only supported way to be able to run this on a hook. Anyone have experience adding cache tags to the headers of an entire content type to invalidate a lot of content at once?
This is the most detailed resource on Drupal 7 usage that I know of for setting and clearing custom tags: https://capellic.com/2017/11/28/using-pantheon-advanced-page-cache-in-drupal-7/ and here’s a Drupal 8 doc.
Let me know if those help. I’m the maintainer of Pantheon Advanced Page Cache.
I mean in the context of Pantheon operations, the cache clear that would clear out the CDN/Varnish cache. I actually enabled the cache backends for the d8cache/advanced caching modules (which hadn’t been configured correctly), and it did generate cache tags appropriate to our needs. I am curious if I was pulling out data or fields from nodes, but not rendering them fully, if there would be a way to generate tags to clear all node pages of a certain content type.
I am familiar with that article you linked, and I have looked through some of the documentation about the new cache system in d8, but it’s not clear what all the possible variants there are for cache tags.
Hi @jcmiller09, to my knowledge
drupal_flush_all_caches() does clear the the entire CDN cache as well. Let me know if you see different behavior.
For generating custom tags that declare which node types have been loaded on a given page (even if they aren’t rendered as a view mode) I would recommend using hook_node_load and checking the type of the loaded nodes.