Skip to content

Commit

Permalink
Cache clear improvement.
Browse files Browse the repository at this point in the history
Updating an Alert banner now resorts to less destructive route rebuilding
instead of rebuilding the entire cache.
  • Loading branch information
Adnan-cds committed Jul 16, 2021
1 parent d5a57ca commit ec37303
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Entity/AlertBannerEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ public function preSave(EntityStorageInterface $storage) {
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);

// Better to use cache tags instead of doing a full flush?
drupal_flush_all_caches();
// Needed by the entity.localgov_alert_banner.status_form route to function
// correctly during *test runs*. Not the ideal solution, but less
// destructive than drupal_flush_all_caches().
\Drupal::service('router.builder')->setRebuildNeeded();
}

/**
Expand Down

0 comments on commit ec37303

Please sign in to comment.