返回由键标识的列表的大小。如果该列表不存在或为空,则命令返回0。如果由Key标识的数据类型不是列表,则命令返回FALSE。
Parameters:
string $key
Returns:
由键标识的列表的大小存在。如果由键标识的数据类型不是列表,则为FALSE
Declared in: Redis
Links: https://redis.io/commands/llen
Source:
S:/Software/JetBrains/PHPStorm/App/PhpStorm-2020.2.1.win/plugins/php/lib/php.jar!/stubs/redis/Redis.phplLen
on redis.io
<?php
//连接本地的 Redis 服务
$redis = new Redis();
$redis->connect('10.1.3.15', 6379);
$redis->auth('kuaicdn_redis_passwd');
$redis->flushAll();
$ret['exec'][]=$redis->rPush('list_test','value1');
$ret['exec'][]=$redis->rPush('list_test','value2');
$ret['exec'][]=$redis->rPush('list_test','value3');
$ret['exec'][]=$redis->rPush('list_test','value4');
$ret['exec'][]=$redis->rPush('list_test','value5');
$ret['cmd']=$redis->lLen('list_test');
$ret['src'][]=$redis->lRange('list_test',0,-1);
print_r($ret);
?>