You are here

public function Memory::claimItem in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Queue/Memory.php \Drupal\Core\Queue\Memory::claimItem()
  2. 9 core/lib/Drupal/Core/Queue/Memory.php \Drupal\Core\Queue\Memory::claimItem()

File

core/lib/Drupal/Core/Queue/Memory.php, line 64

Class

Memory
Static queue implementation.

Namespace

Drupal\Core\Queue

Code

public function claimItem($lease_time = 30) {
  foreach ($this->queue as $key => $item) {
    if ($item->expire == 0) {
      $item->expire = \Drupal::time()
        ->getCurrentTime() + $lease_time;
      $this->queue[$key] = $item;
      return $item;
    }
  }
  return FALSE;
}