Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mateusjatenee
Copy link
Contributor

@mateusjatenee mateusjatenee commented Aug 26, 2025

Allows Redis connections to be retried automatically.

The additional configuration is only applied if the phpredis extension is loaded. It depends on constants that are not available without it — for users running other cache drivers, or running Predis, nothing changes.

decorrelated_jitter is used by default to avoid "retry storms" — Here's an AWS article

With the default configuration, retry delays would be ~300ms, ~600ms, ~1000ms, for a ~2 second total retry window.

This is a bit of a beefy config, mostly because of that match statement — maybe we could pass strings and parse them on framework — that'd also solve having to be careful with calling the Redis namespace

@taylorotwell
Copy link
Member

@mateusjatenee yeah I would extract that match into the framework's Redis facade or something.

@mateusjatenee
Copy link
Contributor Author

@taylorotwell docs PR here: laravel/docs#10787

I kept it very brief, but I can expand if you think it deserves more space.

As for this PR, I removed the extension_loaded('redis') conditional in favor of making the config smaller — it doesn't break if the user is running predis, it just doesn't do anything. Let me know if we should be more explicit there.

@mateusjatenee mateusjatenee marked this pull request as ready for review August 29, 2025 15:53
@taylorotwell taylorotwell merged commit 9905b67 into 12.x Aug 29, 2025
5 checks passed
@taylorotwell taylorotwell deleted the cache-retries branch August 29, 2025 17:40
@xtrasmal
Copy link

Careful with this one @taylorotwell
PR has the 👹👹👹 mark of the beast

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

Successfully merging this pull request may close these issues.

3 participants