ThrottlesExceptions
Properties
$key string
The developer specified key that the rate limiter should use.
$byJob bool
Indicates whether the throttle key should use the job's UUID.
$maxAttempts int
The maximum number of attempts allowed before rate limiting applies.
$decayMinutes int
The number of minutes until the maximum attempts are reset.
$retryAfterMinutes int
The number of minutes to wait before retrying the job after an exception.
$whenCallback callable
The callback that determines if rate limiting should apply.
$prefix string
The prefix of the rate limiter key.
Methods
__construct ( $maxAttempts , $decayMinutes ) : void
Create a new middleware instance.
Parameters
- $maxAttempts int
- $decayMinutes int
- $key string
handle ( $job , $next ) : mixed
Process the job.
Parameters
- $job mixed
- $next callable
when ( callable $callback ) : $this
Specify a callback that should determine if rate limiting behavior should apply.
Parameters
- $callback callable
withPrefix ( string $prefix ) : $this
Set the prefix of the rate limiter key.
Parameters
- $prefix string
backoff ( $backoff ) : $this
Specify the number of minutes a job should be delayed when it is released (before it has reached its max exceptions).
Parameters
- $backoff int
getKey ( $job ) : string
Get the cache key associated for the rate limiter.
Parameters
- $job mixed
by ( $key ) : $this
Set the value that the rate limiter should be keyed by.
Parameters
- $key string
byJob ( ) : $this
Indicate that the throttle key should use the job's UUID.
getTimeUntilNextRetry ( $key ) : int
Get the number of seconds that should elapse before the job is retried.
Parameters
- $key string