Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: revalidate some stale caches in the background #187

Open
Cellard opened this issue Apr 17, 2024 · 0 comments
Open

Feature request: revalidate some stale caches in the background #187

Cellard opened this issue Apr 17, 2024 · 0 comments

Comments

@Cellard
Copy link

Cellard commented Apr 17, 2024

It would be nice to have an option to refresh some stale caches in the background. With such mechanism, middleware could increment the overall application performance.

At least stale-while-revalidate directive explicitly says about revalidating of responses in the background.

Beyond that, we could invent an explicit way to manage refreshable caches. For example:

Make a request:

// Possible way to mark a request as refreshable — add 'refreshable' to its config
$client = new Client($config + ['refreshable' => true]);
$client->get('https://example.com/resource');

Then, run as a scheduled job:

// Possible way to select requests for refreshing — filter caches with method/url
$magic->revalidateStaled(['https://example.com/']);

If @Kevinrob says this is possible and reasonble — I could try to make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant