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) Получить количество секунд до заданной даты DateTime. | 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) Обработать входящий запрос. | |
| 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)
Получить количество секунд до заданной даты DateTime.
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)
Обработка входящего запроса.
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/5.7/Illuminate/Routing/Middleware/ThrottleRequestsWithRedis.html