本文整理汇总了PHP中Redis::lLen方法的典型用法代码示例。如果您正苦于以下问题:PHP Redis::lLen方法的具体用法?PHP Redis::lLen怎么用?PHP Redis::lLen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redis
的用法示例。
在下文中一共展示了Redis::lLen方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_can_llen
public function it_can_llen()
{
$this->redis->lLen('test')->shouldBeCalled()->willReturn(1);
$this->lLen('test')->shouldReturn(1);
$this->redis->lLen('test')->willThrow(new \RedisException());
$this->shouldThrow(DriverException::class)->during('lLen', ['test']);
}
示例2: length
public static function length($key)
{
$redis = self::instance();
if ($redis) {
self::$redis->lLen($key);
}
}
示例3: lLen
/**
* @param string $key
* @return int
* @throws CM_Exception_Invalid
*/
public function lLen($key)
{
$length = $this->_redis->lLen($key);
if (false === $length) {
throw new CM_Exception_Invalid('Key `' . $key . '` does not contain a list');
}
return $length;
}
示例4: testDifferentTypeHash
public function testDifferentTypeHash()
{
$key = '{hash}hash';
$dkey = '{hash}hash';
$this->redis->del($key);
$this->assertEquals(1, $this->redis->hSet($key, 'key', 'value'));
// string I/F
$this->assertEquals(FALSE, $this->redis->get($key));
$this->assertEquals(FALSE, $this->redis->getset($key, 'value2'));
$this->assertEquals(FALSE, $this->redis->append($key, 'append'));
$this->assertEquals(FALSE, $this->redis->getRange($key, 0, 8));
$this->assertEquals(array(FALSE), $this->redis->mget(array($key)));
$this->assertEquals(FALSE, $this->redis->incr($key));
$this->assertEquals(FALSE, $this->redis->incrBy($key, 1));
$this->assertEquals(FALSE, $this->redis->decr($key));
$this->assertEquals(FALSE, $this->redis->decrBy($key, 1));
// lists I/F
$this->assertEquals(FALSE, $this->redis->rPush($key, 'lvalue'));
$this->assertEquals(FALSE, $this->redis->lPush($key, 'lvalue'));
$this->assertEquals(FALSE, $this->redis->lLen($key));
$this->assertEquals(FALSE, $this->redis->lPop($key));
$this->assertEquals(FALSE, $this->redis->lrange($key, 0, -1));
$this->assertEquals(FALSE, $this->redis->lTrim($key, 0, 1));
$this->assertEquals(FALSE, $this->redis->lGet($key, 0));
$this->assertEquals(FALSE, $this->redis->lSet($key, 0, "newValue"));
$this->assertEquals(FALSE, $this->redis->lrem($key, 'lvalue', 1));
$this->assertEquals(FALSE, $this->redis->lPop($key));
$this->assertEquals(FALSE, $this->redis->rPop($key));
$this->assertEquals(FALSE, $this->redis->rPoplPush($key, $dkey . 'lkey1'));
// sets I/F
$this->assertEquals(FALSE, $this->redis->sAdd($key, 'sValue1'));
$this->assertEquals(FALSE, $this->redis->srem($key, 'sValue1'));
$this->assertEquals(FALSE, $this->redis->sPop($key));
$this->assertEquals(FALSE, $this->redis->sMove($key, $dkey . 'skey1', 'sValue1'));
$this->assertEquals(FALSE, $this->redis->scard($key));
$this->assertEquals(FALSE, $this->redis->sismember($key, 'sValue1'));
$this->assertEquals(FALSE, $this->redis->sInter($key, $dkey . 'skey2'));
$this->assertEquals(FALSE, $this->redis->sUnion($key, $dkey . 'skey4'));
$this->assertEquals(FALSE, $this->redis->sDiff($key, $dkey . 'skey7'));
$this->assertEquals(FALSE, $this->redis->sMembers($key));
$this->assertEquals(FALSE, $this->redis->sRandMember($key));
// sorted sets I/F
$this->assertEquals(FALSE, $this->redis->zAdd($key, 1, 'zValue1'));
$this->assertEquals(FALSE, $this->redis->zRem($key, 'zValue1'));
$this->assertEquals(FALSE, $this->redis->zIncrBy($key, 1, 'zValue1'));
$this->assertEquals(FALSE, $this->redis->zRank($key, 'zValue1'));
$this->assertEquals(FALSE, $this->redis->zRevRank($key, 'zValue1'));
$this->assertEquals(FALSE, $this->redis->zRange($key, 0, -1));
$this->assertEquals(FALSE, $this->redis->zRevRange($key, 0, -1));
$this->assertEquals(FALSE, $this->redis->zRangeByScore($key, 1, 2));
$this->assertEquals(FALSE, $this->redis->zCount($key, 0, -1));
$this->assertEquals(FALSE, $this->redis->zCard($key));
$this->assertEquals(FALSE, $this->redis->zScore($key, 'zValue1'));
$this->assertEquals(FALSE, $this->redis->zRemRangeByRank($key, 1, 2));
$this->assertEquals(FALSE, $this->redis->zRemRangeByScore($key, 1, 2));
}
示例5: getQueueSize
/**
* return queue length
* @return int the queue length
*/
public function getQueueSize()
{
return $this->_redis->lLen($this->_queueStructName);
}
示例6: getRunningSize
public function getRunningSize()
{
return (int) $this->redis->lLen($this->getTaskRunKey());
}
示例7: llen
/**
* lLen a raw value
*
* @param string $key Cache ID
* @return mixed Value on success or FALSE on failure
*/
public function llen($key)
{
return $this->_redis->lLen($key);
}
示例8: count
/**
* @inheritdoc
*/
public function count()
{
$this->checkClientConnection();
return $this->client->lLen("queue:{$this->name}:messages");
}
示例9: length
/**
* 获取Redis队列长度
*
* @param string $queue Redis队列名
*
* @return int
*/
public function length($queue)
{
return $this->redis->lLen($queue);
}
示例10: Redis
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
// 加上时间戳存入队列
$now_time = date("Y-m-d H:i:s");
$interface_info = array('user_uuid' => '123456df', 'comment' => 'rwesdf');
$r_len = $redis->lLen("call_log");
// for($i = 0; $i < $r_len; $i++){
// $redis->lPop("call_log");
// }
$interface_info = json_encode($interface_info);
for ($i = 1; $i <= 10000; $i++) {
$redis->rPush("call_log", $interface_info);
}