承接 mc0/okq 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mc0/okq

Composer 安装命令:

composer require mc0/okq

包简介

A PHP driver for the okq persistent queue

README 文档

README

A PHP driver for the okq persistent queue.

okq uses the redis protocol and calling conventions as it's interface, so any standard redis client can be used to interact with it. This package wraps around a normal redis driver, however, to provide a convenient interface to interact with. Specifically, it creates a simple interface for event consumers to use so they retrieve events through a channel rather than implementing that logic manually every time.

Usage

Commands for okQ are implemented on the Okq class parameters resemble those of the okQ command itself. The Okq class extends phpredis/Redis and can be constructed using the same arguments:

$q = new Okq();
$q->connect('127.0.0.1', 4777);

Then to add jobs you just run the command!

$event = array('test' => 1);
$eventId = '233'; // this can also be null and will be generated
$success = $q->qlpush('testQueue', json_encode($event), $eventId);

If you're a consumer you can just use the convenience consume method.

/* the $callback can be any callable:
 - array('StaticClass', 'funcName')
 - array($obj, 'funcName')
 - 'funcName'
 - create_function('$event', '...')
*/
$callback = function ($event) use ($q) {
    // do anything or nothing at all
    return Okq::EVENT_ACK;
};
$timeout = 30;
$q->consume($callback, array('testQueue'), $timeout);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-04