You are here

public function CapacityTracker::getTimeHint in Purge 8.3

Get the maximum number of seconds, a purger needs for one invalidation.

Parameters

string $purger_instance_id: The instance ID of the purger from which to return the time hint.

Return value

float The maximum number of seconds - as float - it takes this purger to process a single cache invalidation.

Throws

\Drupal\purge\Plugin\Purge\Purger\Exception\BadPluginBehaviorException Thrown when a returned floating point value is lower than 0.1, higher than 10 or is not returned as float.

\Drupal\purge\Plugin\Purge\Purger\Exception\BadBehaviorException Thrown when $purger_instance_id doesn't exist.

Overrides CapacityTrackerInterface::getTimeHint

See also

\Drupal\purge\Plugin\Purge\Purger\PurgerCapacityDataInterface::getCooldownTime()

File

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

Class

CapacityTracker
Provides the capacity tracker.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

public function getTimeHint($purger_instance_id) {
  $this
    ->gatherTimeHints();
  if (!isset($this->timeHints[$purger_instance_id])) {
    throw new BadBehaviorException("Instance id '{$purger_instance_id}' does not exist!");
  }
  return $this->timeHints[$purger_instance_id];
}