You are here

public function QueueServiceInterface::claim in Purge 8.3

Claim invalidation objects from the queue.

Parameters

int $claims: Determines how many claims should be taken from the queue. When the queue has less items available, less will be returned. When this parameter is left as NULL, CapacityTrackerInterface::getRemainingInvalidationsLimit() will be used as input.

int $lease_time: The expected (maximum) time needed per claim, which will get multiplied for you by the number of claims you request. When this is left NULL, this value comes from CapacityTrackerInterface::getTimeHint().

After the lease_time expires, another running request or CLI process can also claim the items and process them, therefore too short lease times are dangerous as it could lead to double processing.

Return value

\Drupal\purge\Plugin\Purge\Invalidation\InvalidationInterface[]|array Returned will be a non-associative array with the given amount of invalidation objects as claimed. Be aware that it can be expected that the claimed invalidations will need to be processed by the purger within the given $lease_time, else they will become available again. The returned array is empty when the queue is.

1 method overrides QueueServiceInterface::claim()
QueueService::claim in src/Plugin/Purge/Queue/QueueService.php
Claim invalidation objects from the queue.

File

src/Plugin/Purge/Queue/QueueServiceInterface.php, line 50

Class

QueueServiceInterface
Describes a service that lets invalidations interact with a queue backend.

Namespace

Drupal\purge\Plugin\Purge\Queue

Code

public function claim($claims = NULL, $lease_time = NULL);