Final Class Yiisoft\Yii\RateLimiter\CounterState
| Inheritance | Yiisoft\Yii\RateLimiter\CounterState |
|---|
Rate limiter counter state stores information about when the next request won't be limited.
Public Methods
Method Details
| public mixed __construct ( integer $limit, integer $remaining, integer $resetTime, boolean $isFailStoreUpdatedData = false ) | ||
| $limit | integer |
The maximum number of requests allowed with a time period. |
| $remaining | integer |
The number of remaining requests in the current time period. |
| $resetTime | integer |
Timestamp to wait until the rate limit resets. |
| $isFailStoreUpdatedData | boolean |
If fail to store updated the rate limit data. |
public function __construct(
private int $limit,
private int $remaining,
private int $resetTime,
private bool $isFailStoreUpdatedData = false
) {
}
| public integer getLimit ( ) | ||
| return | integer |
The maximum number of requests allowed with a time period. |
|---|---|---|
public function getLimit(): int
{
return $this->limit;
}
| public integer getRemaining ( ) | ||
| return | integer |
The number of remaining requests in the current time period. |
|---|---|---|
public function getRemaining(): int
{
return $this->remaining;
}
| public integer getResetTime ( ) | ||
| return | integer |
Timestamp to wait until the rate limit resets. |
|---|---|---|
public function getResetTime(): int
{
return $this->resetTime;
}
| public boolean isFailStoreUpdatedData ( ) | ||
| return | boolean |
If fail to store updated the rate limit data. |
|---|---|---|
public function isFailStoreUpdatedData(): bool
{
return $this->isFailStoreUpdatedData;
}
| public boolean isLimitReached ( ) | ||
| return | boolean |
If requests limit is reached. |
|---|---|---|
public function isLimitReached(): bool
{
return $this->remaining === 0;
}
Signup or Login in order to comment.