I may be fundamentally misunderstanding something here but it seems to me that if I want to fetch something I can call
let r = await fetch("someurl");
and the browser will use a cached version if it has one. Or I could call
let r = await fetch("someurl", {
cache: "reload"
});
and I would always get a new version.
What I cannot find is how to tell it that I only want the cached version if it is younger than X minutes.
I could do
let r = await fetch("someurl", {
headers: {
"Cache-control": "max-age=180"
}
});
but afaiu that would just get sent to the server and not actually impact what the browser is doing about values in its own cache.