limen/fastrq
Composer 安装命令:
composer require limen/fastrq
包简介
Queue, Stack, Deque, Priority Queue built on Redis
README 文档
README
Features
- Abstract Queue, Deque, Capped Queue/Deque, and Overflow-able Capped Queue/Deque
- Abstract Stack, Capped Stack
- Abstract Priority Queue, Capped Priority Queue and Overflow-able Capped Priority Queue
- Push and Pop support batch operation
- Using Lua scripts to save RTT (Round Trip Time)
more in Wiki
install
Recommend to install via composer
composer require limen/fastrq
Usage
use Limen\Fastrq\Queue; use Limen\Fastrq\Deque; use Limen\Fastrq\Stack; use Limen\Fastrq\PriorityQueue; // queue $q = new Queue('fastrq-queue'); $q->push(['hello', 'world']); $q->push('!!'); $q->pop(); $q->pop(2); $q->pushNI('hello'); $q->pushAE('from'); $q->pushNE(['from', 'fastrq']); // deque $dq = new Deque('fastrq-deque'); $dq->pushFront(['hello', 'world']); $dq->pushBack('!!'); $dq->popFront(); $dq->popBack(2); $dq->pushFrontNI('hello'); $dq->pushBackNI('hello'); $dq->pushFrontNE('from'); $dq->pushBackNE(['from', 'fastrq']); $dq->pushFrontAE('from'); $dq->pushBackAE(['from', 'fastrq']); // stack $s = new Stack('fastrq-stack'); $s->push(['hello', 'world']); $s->push('!!'); $s->pop(); $s->pop(2); $s->pushNI('hello'); $s->pushAE('from'); $s->pushNE(['from', 'fastrq']); // priority queue $pq = new PriorityQueue('fastrq-priority-queue'); $pq->push(['hello' => 1]); $pq->push(['hello' => 1, 'world' => 2]); $pq->pushNI('fastrq', 2); $pq->pushAE(['hello' => 1, 'world' => 2]); $pq->pushNE(['hello' => 1, 'world' => 2]);
Data types
Queue
- first in and first out
- unlimited capacity
- support batch push and batch pop
Deque
Derive from queue with more features
- support push front and push back
- support pop front and pop back
Capped Queue/Deque
Derive from queue/deque with more features
- Have fixed capacity
- Push to a full one would fail
- Push to one whose positions are not enough would fail
Overflow-able Capped Queue/Deque
Derive from capped queue/deque with more features
- The queue length would never exceed its capacity
- Push to an end would push out from the other end if one is full
Stack
- Last in and First out
- Unlimited capacity
- Support batch push and batch pop
Capped Stack
Derive from Stack with more features
- Have fixed capacity
- Push to a full capped stack would fail
- Push to a capped stack whose positions are not enough would fail
Priority Queue
- The lower the score, the higher the priority
- Unlimited capacity
- Support batch push and batch pop
Capped Priority Queue
Derive from Priority Queue with more features
- Have fixed capacity
- Push to a full one would fail
- Push to a capped one whose positions are not enough would fail
Overflow-able Capped Priority Queue
Derive from Capped Priority Queue with more features
- The queue length would never exceed its capacity
- Push to an end would push out from the other end if queue is full
limen/fastrq 适用场景与选型建议
limen/fastrq 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37 次下载、GitHub Stars 达 5, 最近一次更新时间为 2018 年 11 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「redis」 「queue」 「stack」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 limen/fastrq 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 limen/fastrq 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 limen/fastrq 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Microservice RPC through message queues.
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
The CodeIgniter Redis package
贝嘟分布式缓存扩展
Development and debugging tools for Recoil applications.
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-25