Say I have a cached response (web cache, full html) that I want to update every 30m. The thing is that after this 30mins, I want to serve the first next request the "old" cached version, and then in the background flush the cache for that request and re-do it, so that next requests will get an updated version.
For example: I have a cached version of /whatever.php that was cached at 15:00h. Then before 15:30h every request to /whatever.php will receive that cached html, and what I want is that the first request after 15:30h (even if it's at 18:00 or the next day) receives that same cached version and then runs a thread in the background or something to update the cache.
I assume this can be achieved by having an infinite lifetime cache and using a header that forces the cache to update, so then the cache always serves the cached version unless the request forces to update it, but then my problem is: how to take care of time limits in this scenario and how to make a background request (curl or whatever) from a cache-manager server?
Is there any cache technology that would allow me to do something like this?