W3cubDocs

/Drupal 8

public function Memory::numberOfItems

public Memory::numberOfItems()

Retrieves the number of items in the queue.

This is intended to provide a "best guess" count of the number of items in the queue. Depending on the implementation and the setup, the accuracy of the results of this function may vary.

e.g. On a busy system with a large number of consumers and items, the result might only be valid for a fraction of a second and not provide an accurate representation.

Return value

An integer estimate of the number of items in the queue.

Overrides QueueInterface::numberOfItems

File

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

Class

Memory
Static queue implementation.

Namespace

Drupal\Core\Queue

Code

public function numberOfItems() {
  return count($this->queue);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Queue!Memory.php/function/Memory::numberOfItems/8.1.x