You are here

public function AcquiaCloudPurger::hasRuntimeMeasurement in Acquia Purge 8

Indicates whether your purger utilizes dynamic runtime measurement.

Implementations of this method should simply return TRUE or FALSE but the consequences of it have to be thoroughly understood. Either scenarios and the resulting behavior explained:

Dynamic runtime measurement enabled (TRUE):

  • ::setRuntimeMeasurement() will inject a counter to your purger instance.
  • ::getRuntimeMeasurement() returns the injected counter.
  • RuntimeMeasurementInterface::start() is called before ::invalidate().
  • RuntimeMeasurementInterface::stop() is called after ::invalidate().
  • Your ::getTimeHint() implementation is assumed to utilize the latest runtime measurement by calling RuntimeMeasurementInterface::get().

In other words, returning TRUE will give you automatic adaptive performance throttling based on data, gathered by automatically set performance counters. When your purgers execute slow, less will be fed in the next call to ::invalidate(). When it performs much better, it will incrementally increase the amount it feeds, over the several next calls to ::invalidate.

Dynamic runtime measurement disabled (FALSE):

  • No calls will be made to ::setRuntimeMeasurement().
  • No calls will be made to ::getRuntimeMeasurement().
  • Your ::getTimeHint() implementation will not use dynamic runtime tracking and carefully and responsibly define the right time hints.

So returning FALSE, makes you responsible for the complex task of defining a realistic time limit in which your code executes at all times. This is so complex, because real-world circumstances (e.g. HTTP delays) can cause sudden drops in productivity, which cannot come at the expense of Drupal's overal stability. This is why Purge rather throttles its own work, than letting things explode in front of the end-user.

Return value

bool Whether dynamic runtime measurement is used and should be injected.

Overrides PurgerCapacityDataInterface::hasRuntimeMeasurement

File

src/Plugin/Purge/Purger/AcquiaCloudPurger.php, line 192

Class

AcquiaCloudPurger
Acquia Cloud.

Namespace

Drupal\acquia_purge\Plugin\Purge\Purger

Code

public function hasRuntimeMeasurement() {
  return TRUE;
}