You are here

public function SystemTestController::system_test_cache_maxage_page in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::system_test_cache_maxage_page()
  2. 9 core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php \Drupal\system_test\Controller\SystemTestController::system_test_cache_maxage_page()

Set cache max-age on the returned render array.

1 string reference to 'SystemTestController::system_test_cache_maxage_page'
system_test.routing.yml in core/modules/system/tests/modules/system_test/system_test.routing.yml
core/modules/system/tests/modules/system_test/system_test.routing.yml

File

core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php, line 262

Class

SystemTestController
Controller routines for system_test routes.

Namespace

Drupal\system_test\Controller

Code

public function system_test_cache_maxage_page() {
  $build['main'] = [
    '#cache' => [
      'max-age' => 90,
    ],
    'message' => [
      '#markup' => 'Cache max-age page example',
    ],
  ];
  return $build;
}