0 follower

Final Class Yiisoft\Yii\RateLimiter\CounterState

InheritanceYiisoft\Yii\RateLimiter\CounterState

Rate limiter counter state stores information about when the next request won't be limited.

Method Details

Hide inherited methods

__construct() public method

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
) {
}

            
getLimit() public method

public integer getLimit ( )
return integer

The maximum number of requests allowed with a time period.

                public function getLimit(): int
{
    return $this->limit;
}

            
getRemaining() public method

public integer getRemaining ( )
return integer

The number of remaining requests in the current time period.

                public function getRemaining(): int
{
    return $this->remaining;
}

            
getResetTime() public method

public integer getResetTime ( )
return integer

Timestamp to wait until the rate limit resets.

                public function getResetTime(): int
{
    return $this->resetTime;
}

            
isFailStoreUpdatedData() public method

public boolean isFailStoreUpdatedData ( )
return boolean

If fail to store updated the rate limit data.

                public function isFailStoreUpdatedData(): bool
{
    return $this->isFailStoreUpdatedData;
}

            
isLimitReached() public method

public boolean isLimitReached ( )
return boolean

If requests limit is reached.

                public function isLimitReached(): bool
{
    return $this->remaining === 0;
}