function SystemTestController::system_test_cache_maxage_page

Same name in other branches
  1. 8.9.x 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;
}

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