Observe cache freshness

Observe the difference between a fresh stored response and one that requires another cache decision.

  • caching
  • freshness

Prediction

A fresh stored response can be reused without validation; after freshness expires, the cache needs another permitted reuse or validation decision.

Controlled observation

Run the fixed request repeatedly within its ten-second freshness lifetime, after expiry, or with an explicit reload. Compare generation time and request ID to distinguish reuse from a new response.

Explanation

Storage, matching, freshness, and reuse are separate decisions. One cached label cannot explain all four.

Controlled exercise

Run this observation

Run twice within ten seconds, then after expiry; compare generation time and request ID.

Interactive controls require JavaScript. The static response and portable examples remain available below.

Ready. No request has run.

Controlled request

Method
GET
URL
https://lab.httpclarity.com/v1/cache-freshness
Permitted headers
None
Body
None

Browser-observed response

No live response yet. The representative static example remains useful without JavaScript or the Worker.

Static response example

HTTP/1.1 200 OK
Cache-Control: private, max-age=10
X-Lab-Scenario: cache-freshness

{"generatedAt":"2026-07-14T00:00:00.000Z","scenario":"cache-freshness","version":"httpclarity-cache-v1"}

Timing is browser elapsed time. Fetch hides Set-Cookie, raw wire bytes, reliable compressed size, and some redirect details.

Portable examples

cURL
'curl' '--include' '--request' 'GET' 'https://lab.httpclarity.com/v1/cache-freshness'
Scroll horizontally to read any long lines.
Fetch API
const response = await fetch("https://lab.httpclarity.com/v1/cache-freshness", {
  "method": "GET"
});
console.log(response.status, await response.text());
Scroll horizontally to read any long lines.
PHP
<?php
$options = ['http' => [
    'method' => 'GET',
    'ignore_errors' => true,
]];
$context = stream_context_create($options);
$body = file_get_contents('https://lab.httpclarity.com/v1/cache-freshness', false, $context);
var_dump($http_response_header, $body);
Scroll horizontally to read any long lines.

Need a full API client? Copy the generated cURL command, then import it in Hoppscotch. HTTPClarity sends no request data to Hoppscotch.

Continue in Hoppscotch (opens in a new tab)

Primary sources