You are here

public function Redis_Queue_PhpRedis::numberOfItems in Redis 7.2

Same name and namespace in other branches
  1. 7.3 lib/Redis/Queue/PhpRedis.php \Redis_Queue_PhpRedis::numberOfItems()

Retrieve 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 DrupalQueueInterface::numberOfItems

File

lib/Redis/Queue/PhpRedis.php, line 48

Class

Redis_Queue_PhpRedis
@todo Set high expire value to the hash for rotation when memory is empty React upon cache clear all and rebuild path list?

Code

public function numberOfItems() {
  return $this
    ->getClient()
    ->llen($this
    ->getKeyForQueue());
}