redis BLPOP

一、需求

redis中保存了需要download的image url,存储格式为列表。

我需要从列表中获取数据,将图片下载保存到本地。

列表中的数据是一直增加的。

二、实现

使用redis BLPOP阻塞式弹出,当没有需要下载的图片时,一直等待新数据

while True:

    ret = r.blpop(key, timeout=0)

原文地址:https://www.cnblogs.com/shining5/p/11793370.html