Skip to content

Commit 2725425

Browse files
committed
Set Cache-Control for ChangeLogs on the application side
1 parent 98b0eb6 commit 2725425

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

include/changelogs.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ function changelog_header(int $major_version, array $minor_versions): void {
4848
'current' => 'docs',
4949
'css' => ['changelog.css'],
5050
'layout_span' => 12,
51+
'cache' => true,
52+
'cache_control' => 30 * 60, // 30 minutes
5153
]);
5254
echo "<h1>PHP {$major_version} ChangeLog</h1>\n";
5355
$glue = '';

include/header.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ if ($config["cache"]) {
4949
}
5050
header("Last-Modified: " . $tsstring);
5151
}
52+
53+
if ($config["cache_control"] && is_numeric($config["cache_control"])) {
54+
header("Cache-Control: public, max-age=" . (int) $config["cache_control"]);
55+
}
56+
5257
if (!isset($config["languages"])) {
5358
$config["languages"] = [];
5459
}

include/layout.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ function site_header(?string $title = NULL, array $config = []): void
456456
'classes' => '',
457457
'layout_span' => 9,
458458
"cache" => false,
459+
'cache_control' => false,
459460
"headsup" => "",
460461
'meta_tags' => <<<META
461462
<meta name="Description" content="{$meta_description}" />

0 commit comments

Comments
 (0)