You are here

public function CapacityTrackerInterface::getRemainingInvalidationsLimit in Purge 8.3

Get the remaining number of allowed cache invalidations for this request.

External cache invalidation is expensive and can become exponentially more expensive when multiple platforms are being invalidated. To assure that we don't purge more than request lifetime allows for, ::getTimeHintTotal() gives the highest number of seconds a cache invalidation could take.

A call to ::getRemainingInvalidationsLimit() calculates how many cache invalidations are left to be processed during this request. It bases its decision on ::getMaxExecutionTime() and ::getIdealConditionsLimit() and information tracked during request lifetime. When it returns zero, no more items can be claimed from the queue or fed to the purgers service.

In order to track this global limit, ::decrementLimit() gets called every time the purgers service attempted one or more invalidations until the value becomes zero.

Return value

int The remaining number of allowed cache invalidations during the remainder of Drupal's request lifetime. When 0 is returned, no more can take place.

See also

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

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

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

1 method overrides CapacityTrackerInterface::getRemainingInvalidationsLimit()
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/CapacityTrackerInterface.php, line 135

Class

CapacityTrackerInterface
Describes the capacity tracker.

Namespace

Drupal\purge\Plugin\Purge\Purger

Code

public function getRemainingInvalidationsLimit();