↗ Adding stale while revalidate functionality to Laravel's cache
13 Nov 2023 via rias.be
A stale while revalidate cache macro by Rias Van der Veken. With stale while revalidate, expired cache items will still be used when requested, but the data will be revalidated right after. That means the current request will be handled faster than if the cache would have to be revalidated, and the next request will receive fresh data.
Stale while revalidate is often used in web applications, popularized by Vercel's SWR React library.