Skip to content

Commit d992065

Browse files
authored
fix: Updates to cache control (#172)
1 parent 09d18cd commit d992065

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/index.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@
2222
renderOutput($message);
2323
}
2424

25-
26-
// set cache to refresh once per day
27-
$timestamp = gmdate("D, d M Y 23:59:00") . " GMT";
28-
header("Expires: $timestamp");
29-
header("Last-Modified: $timestamp");
30-
header("Pragma: no-cache");
31-
header("Cache-Control: no-cache, must-revalidate");
25+
// set cache to refresh once per hour
26+
header("Expires: " . gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");
27+
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
28+
header("Cache-Control: public, max-age=3600");
3229

3330
// redirect to demo site if user is not given
3431
if (!isset($_REQUEST["user"])) {
@@ -46,6 +43,6 @@
4643
}
4744
$stats = getContributionStats($contributions);
4845
renderOutput($stats);
49-
} catch (InvalidArgumentException|AssertionError $error) {
46+
} catch (InvalidArgumentException | AssertionError $error) {
5047
renderOutput($error->getMessage());
5148
}

0 commit comments

Comments
 (0)