thinkphp队列queue的一些使用说明,queue:work和queue:listen的区别
获取帮助
php think queue:work --help
Usage: queue:work [options] Options: --queue[=QUEUE] The queue to listen on --daemon Run the worker in daemon mode --delay[=DELAY] Amount of time to delay failed jobs [default: 0] --force Force the worker to run even in maintenance mode --memory[=MEMORY] The memory limit in megabytes [default: 128] --sleep[=SLEEP] Number of seconds to sleep when no job is available [default: 3] --tries[=TRIES] Number of times to attempt a job before logging it failed [default: 0] -h, --help Display this help message -V, --version Display this console version -q, --quiet Do not output any message --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
php think queue:+指令
queue:restart 队列重启 queue:work 队列执行 queue:listen 队列监听 queue:subscribe 队列订阅
后台遍历执行:
php think queue:work --daemon #或者 php think queue:listen
queue:work --daemon和queue:listen的区别
queue:work --daemon 在修改job下面的代码后需要重启服务,利用的是缓存方式(相当于常驻内存),速度非常高效!!!推荐。 queue:listen 修改job下面代码实时生效,每次都会重新载入框架,相对来说更消耗性能,调试时使用或者不行经常重启时采用
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了