You are here

public function CapacityTracker::getCooldownTime in Purge 8.3

Get the time in seconds to wait after invalidation for a specific purger.

Parameters

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

Return value

float The maximum number of seconds - as float - to wait after invalidation.

Throws

\Drupal\purge\Plugin\Purge\Purger\Exception\BadPluginBehaviorException Thrown when the returned floating point value is lower than 0.0, higher than 3.0 or is not returned as floating point value.

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

Overrides CapacityTrackerInterface::getCooldownTime

See also

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

\Drupal\purge\Plugin\Purge\Purger\CapacityTrackerInterface::waitCooldownTime()

1 call to CapacityTracker::getCooldownTime()
CapacityTracker::waitCooldownTime in src/Plugin/Purge/Purger/CapacityTracker.php
Wait the time in seconds for the given purger.

File

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

Class

CapacityTracker
Provides the capacity tracker.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

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