scones/resque
Composer 安装命令:
composer require scones/resque
包简介
resque (for php) is a Redis-backed library for creating background jobs, placing them on multiple queues, and processing them later. compatible to the original http://resque.github.io/
README 文档
README
Resque
PHP implementation of the resque mechanism.
This is a completely new implementation featuring things as
- no static methods
- minimalistic dependencies (only core features for the asynchronous task processing)
- good coding standards
- psr events as tasks, thus the behavior can be modified
- strict typing
Install
In most cases it should suffice to just install it via composer.
composer require scones/resque "*@stable"
How does it work?
The resque task processing is a decentral queueing system. (read: no master server or similar) There are two parts to the processing, pushing jobs and working job. Those should not run in the same application or at least process to gain the most benefit from it.
pushing jobs
The first step to process a job is to put it on the queue. Assuming you have the resque class already instantiated, you'd be just calling $resque->enqueue('SomeClass', ['some' => 'data'], 'some_queue')
This method puts the task on the queue and returns. It will not process it, as it is not its job. The data is stored (in a very precise format) in a redis database.
working jobs
The second step to process a job is the worker. The worker is an process running anywhere with access to the same redis database.
The worker waits new entries in the configured queues and fetches one, as soon as it's available.
When this happens, it builds the corresponding class (from the supplied container/servicelocator, see examples) and invokes perform with the array provided in enqueue as arguments.
Examples
Find runnable usage examples under https://github.com/scones/resque-examples
scones/resque 适用场景与选型建议
scones/resque 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 90 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 10 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「Tasks」 「resque」 「message queue」 「task queue」 「psr-12」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 scones/resque 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 scones/resque 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 scones/resque 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Redis backed library for creating background jobs and processing them later. Based on resque for Ruby.
Tasks for NetCommons Plugin
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
Redis backend library for creating background jobs and processing them later. PHP port based on resque for Ruby.
A Symfony 2-3 bundle to manage Resque job queues
统计信息
- 总下载量: 90
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 12
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-21