nginx - serving stale cache response while updating
What you're looking for is called stale-while-revalidate (RFC 5861) and it's implemented in nginx as a directive called proxy_cache_background_update. Similar functionality can be found in Varnish 4 and in Squid this is called Collapsed Forwarding.
This feature was added in nginx
1.11 (April 2016) as proxy_cache_background_update