hackthissite/php-bull-scheduler

PHP 库,用于为 NodeJS Bull Redis 队列调度 Redis 任务

dev-master 2019-01-29 10:50 UTC

This package is auto-updated.

Last update: 2024-09-29 05:02:24 UTC


README

PHP 库,用于为 NodeJS Bull Redis 队列 调度任务。

要求

  • PHP >= 5.5.0
  • PHP JSON 扩展
  • Redis >= 2.8.18

安装

通过 composer 安装: composer require hackthissite/php-bull-scheduler

使用方法

此库在 HackThisSite\BullScheduler 命名空间下运行,并使用 Predis 作为底层库。

<?php

require_once 'vendor/autoload.php';

use HackThisSite\BullScheduler\Queue;

// You can specify any value for Redis that Predis considers valid for the first parameter of Predis\Client
$queue = new Queue('example queue', 'tcp://:6379');
$queue2 = new Queue('another queue', array('redis' => array('host' => 'localhost', 'port' => 6379)));
$queue3 = new Queue('different queue', new Predis\Client());

$job_id = $queue->add(array('data' => 'value'));

注意事项

  • 此库已在 Bull v3.6.0 上进行了测试。未对其他版本进行测试,因此使用其他版本时请自行承担风险。
  • 此库仅处理调度(添加新任务),永远不会处理任何形式的任务处理,包括任务状态。

许可证

PHP Bull Scheduler 的代码根据 MIT 许可证(见 LICENSE)分发。