Other tries

This commit is contained in:
Pierre Martin 2021-03-08 04:57:46 +01:00
parent 55647a6ff1
commit 74b63f1f6f
3 changed files with 24 additions and 2 deletions

View File

@ -1,8 +1,12 @@
<?php <?php
header('Cache-Control: max-age=20, stale-while-revalidate=80'); header('Cache-Control: s-max-age=10, stale-while-revalidate=20');
sleep(10); sleep(5);
print('This is a slow test. ' . date('Y-m-d H:i:s')); print('This is a slow test. ' . date('Y-m-d H:i:s'));
?> ?>
<ul>
<li><a href="./slow.php">Slow</a></li>
<li><a href="./slow-but-fast.php">Slow but fast</a></li>
</ul>
<p id="js-date"></p> <p id="js-date"></p>
<script type="text/javascript"> <script type="text/javascript">
document.getElementById('js-date').innerText = new Date().toISOString(); document.getElementById('js-date').innerText = new Date().toISOString();

9
web/slow-but-fast.php Normal file
View File

@ -0,0 +1,9 @@
<?php
header('Cache-Control: s-max-age=1, stale-while-revalidate=20');
sleep(5);
print('This is a slow instant test. ' . date('Y-m-d H:i:s'));
?>
<p id="js-date"></p>
<script type="text/javascript">
document.getElementById('js-date').innerText = new Date().toISOString();
</script>

9
web/slow.php Normal file
View File

@ -0,0 +1,9 @@
<?php
header('Cache-Control: s-max-age=10');
sleep(5);
print('This is a slow instant test. ' . date('Y-m-d H:i:s'));
?>
<p id="js-date"></p>
<script type="text/javascript">
document.getElementById('js-date').innerText = new Date().toISOString();
</script>