public function DatabaseQueue::numberOfItems in Purge 8.3
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
int An integer estimate of the number of items in the queue.
Overrides DatabaseQueue::numberOfItems
File
- src/
Plugin/ Purge/ Queue/ DatabaseQueue.php, line 107
Class
- DatabaseQueue
- A QueueInterface compliant database backed queue.
Namespace
Drupal\purge\Plugin\Purge\QueueCode
public function numberOfItems() {
$query = $this->connection
->select(static::TABLE_NAME);
$query
->addExpression('COUNT(*)');
return (int) $query
->execute()
->fetchField();
}