Could anyone share some guidance into how to cache a call in the browser and have it last 5 minutes, 30 seconds, really anytime at all?
I'm having some real difficulties with this.
This works but can't figure out how to make it expire
fetch(
'/get/id',
{
method: 'GET',
headers: { 'Content-Type': 'application/json' },
cache: 'force-cache'
}
);
This doesn't work at all
fetch(
'/get/id',
{
method: 'GET',
headers: { 'Content-Type': 'application/json', 'Cache-Control': 'max-age=30' },
}
);