search

Home  >  Q&A  >  body text

redis - 关于php任务队列的问题

最近在学习redis,list数据类型很适合做任务队列。之前没有接触过,我的理解是创建任务队列,然后做个定时任务去操作这个队列,比如取前10个去执行,执行完弹出,以此循环,直到队列内没有任务,但是这个定时任务还是会每隔多久去查询一次是否有任务要执行。这样理解对吗?

阿神阿神2760 days ago747

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-25 09:05:15

    That’s not entirely correct. You can use a cron scheduled task to regularly fetch tasks from the task queue for execution.
    You can also run a php-worker daemon to continuously execute tasks. As long as the previous task is completed, it will go to the task queue to fetch the next task and start execution.

    reply
    0
  • Cancelreply