You are here

public function CapacityTracker::getMaxExecutionTime in Purge 8.3

Get the maximum PHP execution time that is available to cache invalidation.

Return value

int The maximum number of seconds available to cache invalidation. Zero means that PHP has no fixed execution time limit, for instance on the CLI.

Overrides CapacityTrackerInterface::getMaxExecutionTime

1 call to CapacityTracker::getMaxExecutionTime()
CapacityTracker::getRemainingInvalidationsLimit in src/Plugin/Purge/Purger/CapacityTracker.php
Get the remaining number of allowed cache invalidations for this request.

File

src/Plugin/Purge/Purger/CapacityTracker.php, line 250

Class

CapacityTracker
Provides the capacity tracker.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

public function getMaxExecutionTime() {
  if (is_null($this->maxExecutionTime)) {
    $this->maxExecutionTime = (int) ini_get('max_execution_time');

    // When the limit isn't infinite, chop 20% off for the rest of Drupal.
    if ($this->maxExecutionTime !== 0) {
      $this->maxExecutionTime = intval(0.8 * $this->maxExecutionTime);
    }
  }
  return $this->maxExecutionTime;
}