小白教程
所有教程
关于
Search
172.70.130.202
172.70.130.202
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Lists blpop”的源代码
本页内容
下一节:
Lists_brpop
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:BLPOP key1 [key2 ] timeout}}[[Category:redis lists|1]] = Redis Blpop 命令 = [[redis lists|Redis 列表(List)]] Redis Blpop 命令移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。 === 语法 === redis Blpop 命令基本语法如下: <sample title="" desc="" lang="redis" hererun="1"> redis 127.0.0.1:6379> BLPOP LIST1 LIST2 .. LISTN TIMEOUT </sample> === 可用版本 === >= 2.0.0 === 返回值 === 如果列表为空,返回一个 nil 。 否则,返回一个含有两个元素的列表,第一个元素是被弹出元素所属的 key ,第二个元素是被弹出元素的值。 == <sample title="" desc="" lang="redis" hererun="1"> redis 127.0.0.1:6379> BLPOP list1 100 </sample> 在以上实例中,操作会被阻塞,如果指定的列表 key list1 存在数据则会返回第一个元素,否则在等待100秒后会返回 nil 。 <sample title="" desc="" lang="redis" hererun="1"> (nil) (100.06s) </sample> [[redis lists|Redis 列表(List)]]
返回至“
Lists blpop
”。
下一节:
Lists_brpop