You are here

public function PhpRedis::numberOfItems in Redis 8

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 QueueInterface::numberOfItems

File

src/Queue/PhpRedis.php, line 70

Class

PhpRedis
Redis queue implementation using PhpRedis extension backend.

Namespace

Drupal\redis\Queue

Code

public function numberOfItems() {
  return $this->client
    ->lLen($this->availableListKey) + $this->client
    ->lLen($this->claimedListKey);
}