From 9eac89cf6d7fd75dabfba8201cebf85cbeb7c8b1 Mon Sep 17 00:00:00 2001 From: Pierre Martin Date: Mon, 8 Mar 2021 15:40:45 +0100 Subject: [PATCH] Better illustrate the purpose --- web/compromise.php | 9 +++++++++ web/index.php | 10 ++++++++-- web/slow-but-fast.php | 4 ++-- web/slow.php | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 web/compromise.php diff --git a/web/compromise.php b/web/compromise.php new file mode 100644 index 0000000..3fd794b --- /dev/null +++ b/web/compromise.php @@ -0,0 +1,9 @@ + +

+ \ No newline at end of file diff --git a/web/index.php b/web/index.php index 71f39a2..847f06f 100644 --- a/web/index.php +++ b/web/index.php @@ -1,11 +1,17 @@ 5s, times match +// Second visit -> instant, times don't match +// … T+14 -> instant, times don't match +// … T+15 (or 16) -> instant, times match (or almost) +// Nothing for 30s -> 5s, times match +header('Cache-Control: s-max-age=60, stale-while-revalidate=20'); sleep(5); -print('This is a slow test. ' . date('Y-m-d H:i:s')); +print('This is a slow test with data cached for 10s but updated smartly. ' . date('Y-m-d H:i:s')); ?>