class
Illuminate
/
Routing
/
Middleware
/
ThrottleRequestsWithRedis
ThrottleRequestsWithRedis
Extends
Properties
public
$decaysAt array
The timestamp of the end of the current duration by key.
Default: []
public
$remaining array
The number of remaining slots by key.
Default: []
Methods
public
__construct ( RateLimiter $limiter , Factory $redis ) : void
Create a new request throttler.
Parameters
- $limiter RateLimiter
- $redis Factory
protected
handleRequest ( $request , Closure $next , array $limits ) : Symfony\...\Response
Handle an incoming request.
Parameters
protected
tooManyAttempts ( $key , $maxAttempts , $decayMinutes ) : mixed
Determine if the given key has been "accessed" too many times.
Parameters
- $key string
- $maxAttempts int
- $decayMinutes int
protected
calculateRemainingAttempts ( $key , $maxAttempts , $retryAfter ) : int
Calculate the number of remaining attempts.
Parameters
- $key string
- $maxAttempts int
- $retryAfter int|null
protected
getTimeUntilNextRetry ( $key ) : int
Get the number of seconds until the lock is released.
Parameters
- $key string
protected
getRedisConnection ( ) : Connection
Get the Redis connection that should be used for throttling.