You are here

class CacheControl in Cache Control Override 8

Controllers for testing the cache control override.

Hierarchy

  • class \Drupal\cache_control_override_test\Controller\CacheControl

Expanded class hierarchy of CacheControl

File

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

Namespace

Drupal\cache_control_override_test\Controller
View source
class CacheControl {

  /**
   * Controller callback: Test content with a specified max age.
   *
   * @param int $max_age
   *   Max age value to be used in the response.
   *
   * @return array
   *   Render array of page output.
   */
  public function maxAge($max_age = Cache::PERMANENT) {
    return [
      '#markup' => 'Max age test content',
      '#cache' => [
        'max-age' => $max_age,
      ],
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheControl::maxAge public function Controller callback: Test content with a specified max age.