Repeatable: Always

Steps to repeat:
1. Create a new controller in a module
2. Return a render array from within the controller just like this

function testControllerCache() {
  return [
    '#markup' => '<pre>' . date('date('i:s')') . '</pre>',
    '#cache' => [
      'tags' => ['test_tag_should_appear_on_response_headers'],
      'max-age' => 10,
    ],
  ];
}

3. Access the page twice from the corresponding route and check headers, the second access should return a
X-Drupal-Cache: HIT

Expected Results:
The page should be invalidated after 5 seconds and regenerated on request

Actual Results:
The page is cached until 'test_tag_should_appear_on_response_headers' is invalidated

Proposed resolution
The Page Cache Module checks for an Expires header, to set expire times, but it should check page's 'max-age'
as well, and set the appropriate expire time.

Comments

aNickPlx created an issue. See original summary.

aNickPlx’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB

This worked locally

yesct’s picture

StatusFileSize
new1.01 KB
new1.2 KB
new1.01 KB
aNickPlx’s picture

Status: Needs review » Closed (duplicate)