- Issue created by @freelock
- πΊπΈUnited States freelock Seattle
I'm a bit rushed at the moment, but I created an action module for a client to get this done:
namespace Drupal\eca_cache\Plugin\Action; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\PageCache\ResponsePolicy\KillSwitch; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\eca\Plugin\Action\ConfigurableActionBase; /** * Provides a Page Cache Kill Switch action. * * @Action( * id = "page_cache_kill_switch", * label = @Translation("Page Cache Kill Switch"), * description = @Translation("Kill the page cache for this page") * ) */ final class PageCacheKillSwitch extends ConfigurableActionBase { /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static { $self = parent::create( $container, $configuration, $plugin_id, $plugin_definition ); $self->KillSwitch = $container->get('page_cache_kill_switch'); return $self; } /** * {@inheritdoc} */ public function execute(): void { $this->KillSwitch->trigger(); } }
- Merge request !460Issue #3493008 by freelock: Action plugin for Page Cache Kill Switch β (Open) created by freelock
- πΊπΈUnited States freelock Seattle
New action plugin -- this is working on a site in a custom module -- only difference is updating the namespace to eca_cache and updating the plugin id.
- π©πͺGermany jurgenhaas Gottmadingen
Thanks @freelock, this looks like a great enhancement. Before a detailed review, it would be good to fixed the broken tests first.
- Status changed to Needs work
6 days ago 10:57am 24 February 2025