ThrottlesExceptionsWithRedis
class ThrottlesExceptionsWithRedis extends ThrottlesExceptions (View source)
Traits
InteractsWithTime |
Properties
protected string | $key | The developer specified key that the rate limiter should use. | from ThrottlesExceptions |
protected bool | $byJob | Indicates whether the throttle key should use the job's UUID. | from ThrottlesExceptions |
protected int | $maxAttempts | The maximum number of attempts allowed before rate limiting applies. | from ThrottlesExceptions |
protected int | $decayMinutes | The number of minutes until the maximum attempts are reset. | from ThrottlesExceptions |
protected int | $retryAfterMinutes | The number of minutes to wait before retrying the job after an exception. | from ThrottlesExceptions |
protected callable | $whenCallback | The callback that determines if rate limiting should apply. | from ThrottlesExceptions |
protected string | $prefix | The prefix of the rate limiter key. | from ThrottlesExceptions |
protected DurationLimiter | $limiter | The rate limiter instance. | |
protected Factory | $redis | The Redis factory implementation. |
Methods
void | __construct(int $maxAttempts = 10, int $decayMinutes = 10)
Create a new middleware instance. | from ThrottlesExceptions |
mixed | handle(mixed $job, callable $next)
Process the job. | |
$this | when(callable $callback)
Specify a callback that should determine if rate limiting behavior should apply. | from ThrottlesExceptions |
$this | withPrefix(string $prefix)
Set the prefix of the rate limiter key. | from ThrottlesExceptions |
$this | backoff(int $backoff)
Specify the number of minutes a job should be delayed when it is released (before it has reached its max exceptions). | from ThrottlesExceptions |
string | getKey(mixed $job)
Get the cache key associated for the rate limiter. | from ThrottlesExceptions |
$this | by(string $key)
Set the value that the rate limiter should be keyed by. | from ThrottlesExceptions |
$this | byJob()
Indicate that the throttle key should use the job's UUID. | from ThrottlesExceptions |
int | getTimeUntilNextRetry(string $key)
Get the number of seconds that should elapse before the job is retried. | from ThrottlesExceptions |
int | secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime. | from InteractsWithTime |
int | availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp. | from InteractsWithTime |
DateTimeInterface|int | parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance. | from InteractsWithTime |
int | currentTime()
Get the current system time as a UNIX timestamp. | from InteractsWithTime |
Details
void __construct(int $maxAttempts = 10, int $decayMinutes = 10)
Create a new middleware instance.
mixed handle(mixed $job, callable $next)
Process the job.
$this when(callable $callback)
Specify a callback that should determine if rate limiting behavior should apply.
$this withPrefix(string $prefix)
Set the prefix of the rate limiter key.
$this backoff(int $backoff)
Specify the number of minutes a job should be delayed when it is released (before it has reached its max exceptions).
protected string getKey(mixed $job)
Get the cache key associated for the rate limiter.
$this by(string $key)
Set the value that the rate limiter should be keyed by.
$this byJob()
Indicate that the throttle key should use the job's UUID.
protected int getTimeUntilNextRetry(string $key)
Get the number of seconds that should elapse before the job is retried.
protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int currentTime()
Get the current system time as a UNIX timestamp.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/9.x/Illuminate/Queue/Middleware/ThrottlesExceptionsWithRedis.html