- Issue created by @btully
- πΊπΈUnited States chrissnyder Maryland
There are no current plans. However, this is a good idea. If a MR with this feature is introduced I would be happy to include it in the next release.
- πΊπΈUnited States sonfd Portland, ME
It looks like the alerts response is already using the `sitewide_alert_list` cache tag and has the module's settings as a cache dependency.
See Drupal\sitewide_alert\Controller\SitewideAlertsController:load(), ~line 104 β :
// Set response cache so it's invalidated whenever alerts get updated, or // settings are changed. $cacheableMetadata = (new CacheableMetadata()) ->addCacheContexts(['languages']) ->setCacheTags(['sitewide_alert_list']); $cacheableMetadata->addCacheableDependency($sitewideAlertSettings); $response->addCacheableDependency($cacheableMetadata);
In my testing, this is respected and the cache for this route is invalidated as soon as an alert is created/updated/deleted. Which means that I'm able to configure the module's Browser and Shared Cache Maximum Age (in seconds) setting to an extraordinarily high number and still seem updates reflected immediately.
I wonder if it makes sense to add a new setting to the module's setting form. Something like:
Use Drupal's Browser and proxy cache maximum age? with a default value of yes
If no, expose the form as it exists now.We'd also need to alter Drupal\sitewide_alert\Controller\SitewideAlertsController::load(), ~line 127 β to respect this new setting.
And then for BC, we'd need an update hook to set appropriately in existing sites, i.e. to not use Drupal's global max-age.
Thoughts?