Please check these requirements
Description
My feature suggestion is to allow the Stale while Revalidate cache pattern.
This may improve response times by allowing stale cached results to be served, and new results to be fetched by a deferred function.
This is functionality in Laravel for this at https://laravel.com/docs/11.x/cache#swr
Perhaps it could be implemented by passing an array to the expiry time instead of an integer, then use Cache::flexible internally.
Please let me know if you would be open to this feature.
Code sample
$query->cache([60, 300]);
This would trigger a deferred function if older than 60 seconds (Laravel framework takes care of this) while returning results up to 300 seconds old instantly.
Please check these requirements
Description
My feature suggestion is to allow the Stale while Revalidate cache pattern.
This may improve response times by allowing stale cached results to be served, and new results to be fetched by a deferred function.
This is functionality in Laravel for this at https://laravel.com/docs/11.x/cache#swr
Perhaps it could be implemented by passing an array to the expiry time instead of an integer, then use Cache::flexible internally.
Please let me know if you would be open to this feature.
Code sample