本文整理汇总了PHP中Predis\Client::llen方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::llen方法的具体用法?PHP Client::llen怎么用?PHP Client::llen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predis\Client
的用法示例。
在下文中一共展示了Client::llen方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItemCount
/**
* {@inheritdoc}
*/
public function getItemCount()
{
$this->initializeRedis();
if ($this->itemCount === null) {
$key = $this->getKeyForItemList();
$this->itemCount = $this->redis->llen($key);
}
return $this->itemCount;
}
示例2: handleBufferedEvents
/**
*
*/
private function handleBufferedEvents()
{
$length = $this->redis->llen(self::BUFFER_LIST_KEY);
$webHookData = [];
for ($i = 0; $i < $length; $i++) {
$event = $this->redis->rpop(self::BUFFER_LIST_KEY);
$webHookData[] = json_decode($event, true);
}
$this->webHookApi->execute(WebHookEnum::HOST_MESSENGER_ONLINE_STATE_CHANGED, $webHookData);
}
示例3: run
protected function run($urlMethod, $runMethod)
{
$this->getSize();
// 从redis拿出数据,并定义url,随后开始爬行逻辑
while (static::$count < $this->endCounts) {
if ($len = $this->redis->llen('usernames')) {
for ($i = 0; $i < $len; $i++) {
Crawler::$urlMethod($this->redis->lpop('usernames'));
if (!$this->{$runMethod}()) {
continue;
}
}
static::$count++;
} else {
$this->getUsernames(static::$count * $this->size);
}
}
}
示例4: flushQueue
/**
* {@inheritdoc}
*/
public function flushQueue(\Swift_Transport $transport, &$failedRecipients = null)
{
if (!$this->redis->llen($this->key)) {
return 0;
}
if (!$transport->isStarted()) {
$transport->start();
}
$failedRecipients = (array) $failedRecipients;
$count = 0;
$time = time();
while ($message = unserialize($this->redis->lpop($this->key))) {
$count += $transport->send($message, $failedRecipients);
if ($this->getMessageLimit() && $count >= $this->getMessageLimit()) {
break;
}
if ($this->getTimeLimit() && time() - $time >= $this->getTimeLimit()) {
break;
}
}
return $count;
}
示例5: count
/**
* @param string $queueName
* @return int
*/
public function count($queueName)
{
return $this->predis->llen($queueName);
}
示例6: count
/**
* Count messages in the queue
*
* @return integer
*/
public function count()
{
$count = $this->client->llen("queue:{$this->name}:messages");
return $count;
}
示例7: getLength
/**
* @return int
*/
public function getLength()
{
return $this->client->llen($this->getName());
}
示例8: existsList
/**
* @param $key
* @return bool
*/
public function existsList($key)
{
return $this->existsKey($key) && $this->redis->llen($key);
}
示例9: count
/**
* @param string $queueName
* @return mixed
*/
public function count($queueName)
{
/** @noinspection PhpUndefinedMethodInspection */
return $this->predis->llen($queueName);
}