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

[10.x] add getRedisConnection to ThrottleRequestsWithRedis #47742

Merged

Conversation

snmatsui
Copy link
Contributor

@snmatsui snmatsui commented Jul 14, 2023

Problem

\Illuminate\Contracts\Redis\Factory usually become \Illuminate\Redis\RedisManager by DI.
DurationLimiter constructor expects \Illuminate\Redis\Connections\Connection, not \Illuminate\Contracts\Redis\Factory.
It now works because \Illuminate\Redis\RedisManager can behave as \Illuminate\Redis\Connections\Connection by using default connection.

Solution

Passing \Illuminate\Redis\Connections\Connection to DurationLimiter is more prefer.

Users who get benefits from this

Who wants to use Redis non-default connection for throttle count can override getRedisConnection method.

@snmatsui snmatsui changed the title add getRedisConnection to ThrottleRequestsWithRedis [10.x] add getRedisConnection to ThrottleRequestsWithRedis Jul 14, 2023
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.

2 participants