You are here

public function PurgerCapacityDataInterface::getTimeHint in Purge 8.3

Get the maximum number of seconds, processing a single invalidation takes.

Implementations need to return the maximum number of seconds it would take them to process a single invalidation. It is important that this value is not smaller than real code will take to execute, but also not many seconds longer then necessary. If - for instance - your purger relies on external HTTP requests, you can set a reasonable request timeout and also use that as estimate here.

General tips:

  • The float must stay between 0.1 and 10.00 seconds.
  • Always assume that your purger plugin is the only enabled purger.
  • Your returning time will be statically cached during request life-time, so don't return different values during a single request.
  • If your purger is able to bundle all invalidations in one action, try to estimate the smallest fraction of time per object, e.g.: 0.1.
  • If your purger executes invalidation in multiple steps (e.g. some CDNs) that can take many minutes, make sure to keep this value low. Put your objects into PROCESSING and they return back later to check status in which you can finalize their status into SUCCEEDED.

@warning Please take implementing this method seriously, as it strongly influences real-world experiences for end users. Undercutting can result in requests that time out and too high values can lead to queue-processing not being able to keep up.

Return value

float The maximum number of seconds - as a float - it takes you to process.

See also

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

1 method overrides PurgerCapacityDataInterface::getTimeHint()
PurgerBase::getTimeHint in src/Plugin/Purge/Purger/PurgerBase.php
Get the maximum number of seconds, processing a single invalidation takes.

File

src/Plugin/Purge/Purger/PurgerCapacityDataInterface.php, line 90

Class

PurgerCapacityDataInterface
Describes what capacity tracking expects from purger implementations.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

public function getTimeHint();