RateLimitedWithRedis
class RateLimitedWithRedis extends RateLimited (View source)
Traits
InteractsWithTime |
Properties
protected RateLimiter | $limiter | The rate limiter instance. | from RateLimited |
protected string | $limiterName | The name of the rate limiter. | from RateLimited |
bool | $shouldRelease | Indicates if the job should be released if the limit is exceeded. | from RateLimited |
protected Factory | $redis | The Redis factory implementation. | |
array | $decaysAt | The timestamp of the end of the current duration by key. |
Methods
void | __construct(string $limiterName) Create a new middleware instance. | |
mixed | handle(mixed $job, callable $next) Process the job. | from RateLimited |
mixed | handleJob(mixed $job, callable $next, array $limits) Handle a rate limited job. | |
$this | dontRelease() Do not release the job back to the queue if limit is exceeded. | from RateLimited |
int | getTimeUntilNextRetry(string $key) Get the number of seconds that should elapse before the job is retried. | |
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 |
bool | tooManyAttempts(string $key, int $maxAttempts, int $decayMinutes) Determine if the given key has been "accessed" too many times. |
Details
void __construct(string $limiterName)
Create a new middleware instance.
mixed handle(mixed $job, callable $next)
Process the job.
protected mixed handleJob(mixed $job, callable $next, array $limits)
Handle a rate limited job.
$this dontRelease()
Do not release the job back to the queue if limit is exceeded.
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.
protected bool tooManyAttempts(string $key, int $maxAttempts, int $decayMinutes)
Determine if the given key has been "accessed" too many times.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Queue/Middleware/RateLimitedWithRedis.html