We have a AbstractUseStaleRequest that uses the use-stale-while-revalidating pattern. The cached response is stored on a long timeout, with a shorter timeout that causes a Laravel queued job to make the request and overwrite the cache. This is a performance improvement (all upstream requests are served from cache, and the cache is updated asynchronously) and can also be used to cover for prolonged outages (e.g. try to refresh every day, but keep serving cached results for up to a week, or even indefinitely)
Port it into the public library.
We have a
AbstractUseStaleRequestthat uses the use-stale-while-revalidating pattern. The cached response is stored on a long timeout, with a shorter timeout that causes a Laravel queued job to make the request and overwrite the cache. This is a performance improvement (all upstream requests are served from cache, and the cache is updated asynchronously) and can also be used to cover for prolonged outages (e.g. try to refresh every day, but keep serving cached results for up to a week, or even indefinitely)Port it into the public library.