function SystemMessagesBlock::getCacheMaxAge

Same name in other branches
  1. 9 core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock::getCacheMaxAge()
  2. 8.9.x core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock::getCacheMaxAge()
  3. 11.x core/modules/system/src/Plugin/Block/SystemMessagesBlock.php \Drupal\system\Plugin\Block\SystemMessagesBlock::getCacheMaxAge()

Overrides ContextAwarePluginTrait::getCacheMaxAge

File

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.