The saying goes, there are two hard problems in computer science: caching, naming things, and off-by-1 errors. While Drupal certainly has not solved the naming things, it has made a valiant attempt at a decent caching strategy. And for the most part it works great, allowing millions of lines of code to load up quickly the vast majority of the time.
This is more a tip about our favorite automation tool, the Events, Conditions, and Actions (ECA) module, and how it can get you out of a bind when Drupal caching goes too far.
If you have another website or application you want to embed in your Drupal site, especially if there is any kind of personalization or authentication involved, you may need to turn off Drupal's caching for the page you load it on. The ECA Cache module provides an action to change the cache settings of a render array, and combined with the "ECA Entity" event from the cache module, you can set the Max-Age cache header to zero.
For a client site that needed this, we found that was not quite enough -- we also needed to set Drupal's internal page cache kill switch. There wasn't a plugin to handle this just yet, so we created one that may be in ECA Cache shortly -- see https://www.drupal.org/project/eca/issues/3493008 if you need it before it's released.
Add new comment