herosphp/redis-queue
最新稳定版本:v1.0.0
Composer 安装命令:
composer require herosphp/redis-queue
包简介
Redis-Queue adapter herosphp Framework
README 文档
README
redis-queue
install
composer install herosphp/redis-queue
usage
publish queue.config.php
composer vendor:publish "herosphp/redis-queue"
config/process.config.php
return [
'redis-queue' => [
'enable' => true,
'handler' => Consumer::class,
'count' => 1,
'constructor' => [
'consumer_dir' => APP_PATH.'queue',
],
],
];
app/queue/DemoQueue.php
<?php
declare(strict_types=1);
namespace app\queue;
use herosphp\plugin\queue\ConsumerInterface;
class DemoQueue implements ConsumerInterface
{
//要消费的队列名
public string $queue = 'demo';
// 连接名,对应 config/redis_queue.php 里的连接`
public string $connection = 'default';
public function consume(array $data): void
{
echo 'queue'.json_encode($data).PHP_EOL;
}
}
client
Client::send('demo', [1,2,3]); or Client::send('demo', [1,2,3],5); // delay 5s
统计信息
- 总下载量: 83
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-27