thinkphp redis队列配置
2022-07-28 14:14:58
456
{{single.collect_count}}

 二、安装queue扩展,有的下载后框架可能自带queue扩展。

composer require topthink/think-queue

这个命令时下载最新的queue扩展,但是最新的是针对ThinkPHP6.0的,而开发框架是5.0,所以要在php包扩展官网找对应的版本。

1、打开php扩展列表官网Packagist

2、搜think-queue,打开第一个topthink/think-queue - Packagist

3、查看每个版本对框架和环境的要求,1.1.6要求thinkphp是5.0.0,所以选择这个。

composer require topthink/think-queue 1.1.6

配置文件位于 application/extra/queue.php,要有这个文件,队列才生效

eturn [//'connector' => 'Sync''connector'=> 'Redis',// Redis 驱动'expire' => 60,// 任务的过期时间,默认为60秒; 若要禁用,则设置为 null'default'=> 'default',// 默认的队列名称'host' => '127.0.0.1',// redis 主机ip'port' => 6379,// redis 端口'password' => '',// redis 密码'select' => 1,// 使用哪一个 db,默认为 db0'timeout'=> 0,// redis连接的超时时间'persistent' => false,// 是否是长连接];
回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}