function BatchMemory::claimItem

Same name in other branches
  1. 9 core/lib/Drupal/Core/Queue/BatchMemory.php \Drupal\Core\Queue\BatchMemory::claimItem()
  2. 8.9.x core/lib/Drupal/Core/Queue/BatchMemory.php \Drupal\Core\Queue\BatchMemory::claimItem()
  3. 10 core/lib/Drupal/Core/Queue/BatchMemory.php \Drupal\Core\Queue\BatchMemory::claimItem()

Overrides \Drupal\Core\Queue\Memory::claimItem().

Unlike \Drupal\Core\Queue\Memory::claimItem(), this method provides a default lease time of 0 (no expiration) instead of 30. This allows the item to be claimed repeatedly until it is deleted.

Overrides Memory::claimItem

File

core/lib/Drupal/Core/Queue/BatchMemory.php, line 26

Class

BatchMemory
Defines a batch queue handler.

Namespace

Drupal\Core\Queue

Code

public function claimItem($lease_time = 0) {
    if (!empty($this->queue)) {
        reset($this->queue);
        return current($this->queue);
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.