smncd/retask 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

smncd/retask

Composer 安装命令:

composer require smncd/retask

包简介

PHP port of retask by Kushal Das

README 文档

README

This is a PHP port of the retask python module written by Kushal Das.

retask is a lightweight library used to create distributed task queues using Redis.

It is basically a wrapper on top of Redis's existing functionality, and meant to be compatible with the original retask Python module.

⚠️ Here be dragons ⚠️

At the moment this repo is a proof of concept and will probably change a fair bit, so use at your own risk, and have fun!

Installation

The package is available via composer, however you will need to set the project minimum stability to dev:

// composer.json
{
  ...
  "minimum-stability": "dev",
  ...
}

Then, you can install the package like normal:

composer require smncd/retask

Example

// provider.php
<?php
declare(strict_types=1);

require_once __DIR__ . '/vendor/autoload.php';

use Smncd\Retask\Queue;
use Smncd\Retask\Task;


$queue = new Queue('example');

$queue->connect();

$task = new Task([
    'user' => 'John Doe',
    'task' => 'High-five a sea otter.',
]);

$queue->enqueue($task);
// worker.php
<?php
declare(strict_types=1);

require_once __DIR__ . '/vendor/autoload.php';

use Smncd\Retask\Queue;


$queue = new Queue('example');

$queue->connect();

while (true) {
    $task = $queue->dequeue();

    if ($task) {
        $data = $task->data();

        print_r($task->data());
    }
}

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-11