You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
drupal_set_message($this->t('cache_example_expiring_item was set to expire at %time', ['%time' => $expiration_friendly]));
267
+
$this->messenger()->addMessage($this->t('cache_example_expiring_item was set to expire at %time', ['%time' => $expiration_friendly]));
266
268
}
267
269
268
270
/**
@@ -274,14 +276,14 @@ public function cacheClearing($form, &$form_state) {
274
276
// Here we'll remove all cache keys in the 'cache' bin that have
275
277
// expired.
276
278
$this->cacheBackend->garbageCollection();
277
-
drupal_set_message($this->t('\Drupal::cache()->garbageCollection() was called, removing any expired cache items.'));
279
+
$this->messenger()->addMessage($this->t('\Drupal::cache()->garbageCollection() was called, removing any expired cache items.'));
278
280
break;
279
281
280
282
case'remove_all':
281
283
// This removes all keys in a bin using a super-wildcard. This
282
284
// has nothing to do with expiration. It's just brute-force removal.
283
285
$this->cacheBackend->deleteAll();
284
-
drupal_set_message($this->t('ALL entries in the "cache" bin were removed with \Drupal::cache()->deleteAll().'));
286
+
$this->messenger()->addMessage($this->t('ALL entries in the "cache" bin were removed with \Drupal::cache()->deleteAll().'));
285
287
break;
286
288
287
289
case'remove_tag':
@@ -291,7 +293,7 @@ public function cacheClearing($form, &$form_state) {
291
293
'cache_example:1',
292
294
];
293
295
Cache::invalidateTags($tags);
294
-
drupal_set_message($this->t('Cache entries with the tag "cache_example" set to 1 in the "cache" bin were invalidated with \Drupal\Core\Cache\Cache::invalidateTags($tags).'));
296
+
$this->messenger()->addMessage($this->t('Cache entries with the tag "cache_example" set to 1 in the "cache" bin were invalidated with \Drupal\Core\Cache\Cache::invalidateTags($tags).'));
0 commit comments