Final Class Yiisoft\Queue\Cli\SimpleLoop
| Inheritance | Yiisoft\Queue\Cli\SimpleLoop |
|---|---|
| Implements | Yiisoft\Queue\Cli\LoopInterface |
| Uses Traits | Yiisoft\Queue\Cli\SoftLimitTrait |
Protected Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $memorySoftLimit | integer | Yiisoft\Queue\Cli\SimpleLoop |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\Queue\Cli\SimpleLoop | |
| canContinue() | Yiisoft\Queue\Cli\SimpleLoop |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getMemoryLimit() | Yiisoft\Queue\Cli\SimpleLoop | |
| memoryLimitReached() | Yiisoft\Queue\Cli\SoftLimitTrait |
Property Details
Method Details
| public mixed __construct ( integer $memorySoftLimit = 0 ) | ||
| $memorySoftLimit | integer |
Soft RAM limit in bytes. The loop won't let you continue to execute the program if soft limit is reached. Zero means no limit. |
public function __construct(protected int $memorySoftLimit = 0)
{
}
| public boolean canContinue ( ) |
public function canContinue(): bool
{
return !$this->memoryLimitReached();
}
| protected integer getMemoryLimit ( ) |
protected function getMemoryLimit(): int
{
return $this->memorySoftLimit;
}
| protected boolean memoryLimitReached ( ) |
protected function memoryLimitReached(): bool
{
$limit = $this->getMemoryLimit();
if ($limit !== 0) {
$usage = memory_get_usage(true);
if ($usage >= $limit) {
return true;
}
}
return false;
}
Signup or Login in order to comment.