You are here

public function SystemMessagesBlock::getCacheMaxAge in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock::getCacheMaxAge()

The maximum age for which this object may be cached.

Return value

int The maximum time in seconds that this object may be cached.

Overrides ContextAwarePluginTrait::getCacheMaxAge

File

core/modules/system/src/Plugin/Block/SystemMessagesBlock.php, line 43

Class

SystemMessagesBlock
Provides a block to display the messages.

Namespace

Drupal\system\Plugin\Block

Code

public function getCacheMaxAge() {

  // The messages are session-specific and hence aren't cacheable, but the
  // block itself *is* cacheable because it uses a #lazy_builder callback and
  // hence the block has a globally cacheable render array.
  return Cache::PERMANENT;
}