ThrottleRequestsWithRedis
class ThrottleRequestsWithRedis extends ThrottleRequests (View source)
Свойства
| InteractsWithTime |
Свойства
| protected RateLimiter | $limiter | Экземпляр лимитера. | from ThrottleRequests |
| protected Factory | $redis | Реализация фабрики Redis. | |
| int | $decaysAt | Маркер времени окончания текущей продолжительности. | |
| int | $remaining | Количество оставшихся слотов. |
Методы
| int | secondsUntil(DateTimeInterface|DateInterval|int $delay)
Получить количество секунд до указанной даты и времени. | from InteractsWithTime |
| int | availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Получить отметку времени "доступно в" в формате Unix Timestamp. | from InteractsWithTime |
| DateTimeInterface|int | parseDateInterval(DateTimeInterface|DateInterval|int $delay)
Если заданное значение является интервалом, преобразовать его в экземпляр DateTime. | from InteractsWithTime |
| int | currentTime()
Получить текущее системное время в формате Unix Timestamp. | from InteractsWithTime |
| void | __construct(Factory $redis)
Создать новый лимитер запросов. | |
| Response | handle(Request $request, Closure $next, int|string $maxAttempts = 60, float|int $decayMinutes = 1, string $prefix = '')
Обработать входящий запрос. | |
| int | resolveMaxAttempts(Request $request, int|string $maxAttempts)
Определить количество попыток, если пользователь авторизован или нет. | from ThrottleRequests |
| string | resolveRequestSignature(Request $request)
Определить подпись запроса. | from ThrottleRequests |
| ThrottleRequestsException | buildException(string $key, int $maxAttempts)
Создать исключение "слишком много попыток". | from ThrottleRequests |
| int | getTimeUntilNextRetry(string $key)
Получить количество секунд до сброса блокировки. | |
| Response | addHeaders(Response $response, int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Добавить информацию о лимите в заголовки ответа. | from ThrottleRequests |
| array | getHeaders(int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Получить информацию о заголовках лимита. | from ThrottleRequests |
| int | calculateRemainingAttempts(string $key, int $maxAttempts, int|null $retryAfter = null)
Вычислить оставшееся количество попыток. | |
| mixed | tooManyAttempts(string $key, int $maxAttempts, int $decayMinutes)
Определить, было ли к заданному ключу слишком много обращений. |
Подробное описание
protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)
Получить количество секунд до указанной даты и времени.
protected int availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Получить отметку времени "доступно в" в формате Unix Timestamp.
protected DateTimeInterface|int parseDateInterval(DateTimeInterface|DateInterval|int $delay)
Если заданное значение является интервалом, преобразовать его в экземпляр DateTime.
protected int currentTime()
Получить текущее системное время в формате Unix Timestamp.
void __construct(Factory $redis)
Создать новый лимитер запросов.
Ответ handle(Запрос $request, Closure $next, int|string $maxAttempts = 60, float|int $decayMinutes = 1, string $prefix = '')
Обработка входящего запроса.
protected int resolveMaxAttempts(Запрос $request, int|string $maxAttempts)
Определение количества попыток, если пользователь авторизован или нет.
protected string resolveRequestSignature(Запрос $request)
Определение подписи запроса.
protected ThrottleRequestsException buildException(string $key, int $maxAttempts)
Создание исключения «слишком много попыток».
protected int getTimeUntilNextRetry(string $key)
Получение количества секунд до снятия блокировки.
protected Response addHeaders(Response $response, int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Добавление информации о лимите в заданный ответ.
protected array getHeaders(int $maxAttempts, int $remainingAttempts, int|null $retryAfter = null)
Получение информации о заголовках лимита.
protected int calculateRemainingAttempts(string $key, int $maxAttempts, int|null $retryAfter = null)
Вычисление количества оставшихся попыток.
protected mixed tooManyAttempts(string $key, int $maxAttempts, int $decayMinutes)
Определение, превышено ли количество попыток для данного ключа.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/6.x/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.html