You are here

public function CacheControl::maxAge in Cache Control Override 8

Controller callback: Test content with a specified max age.

Parameters

int $max_age: Max age value to be used in the response.

Return value

array Render array of page output.

1 string reference to 'CacheControl::maxAge'
cache_control_override_test.routing.yml in tests/modules/cache_control_override_test/cache_control_override_test.routing.yml
tests/modules/cache_control_override_test/cache_control_override_test.routing.yml

File

tests/modules/cache_control_override_test/src/Controller/CacheControl.php, line 21

Class

CacheControl
Controllers for testing the cache control override.

Namespace

Drupal\cache_control_override_test\Controller

Code

public function maxAge($max_age = Cache::PERMANENT) {
  return [
    '#markup' => 'Max age test content',
    '#cache' => [
      'max-age' => $max_age,
    ],
  ];
}