项目作者: halaei

项目描述 :
Redis queue driver for Laravel < 5.6 with blocking pop support (this is ported to laravel 5.6 core)
高级语言: PHP
项目地址: git://github.com/halaei/bredis.git
创建时间: 2016-09-20T10:38:42Z
项目社区:https://github.com/halaei/bredis

开源协议:

下载


bredis queue driver for Laravel

Build Status
Latest Stable Version
Total Downloads
Latest Unstable Version
License

When do you need bredis?

You need bredis when all of these are applied:

  1. You don’t want your jobs to be delayed because your workers are currently sleeping.
  2. You don’t want to run queue:work --sleep=0 on current Redis queue driver because it will devour your CPU when there is no job.

Hence, you need your workers to idle-wait for a job and process them just when they arrive, with nearly no delay.
With bredis you can happily run queue:work --sleep=0 without worrying about busy waiting and CPU overload.

Installation

1. Install the package via compioser

  1. composer require halaei/bredis

2. Add the service provider to your config/app.php

  1. Halaei\BRedis\BlockingRedisServiceProvider::class

3. Add bredis connections to app/queue.php

  1. 'bredis' => [
  2. 'driver' => 'bredis',
  3. 'connection' => 'default',
  4. 'queue' => 'default',
  5. 'retry_after' => 90,
  6. 'timeout' => 10, //Maximum seconds to wait for a job
  7. ],

Please note that if you need to increase ‘timeout’ in the config array above, you should increase ‘retry_after’ in the array as well as —timeout in your queue:work commands.

Warning: bredis queue workers don’t bother handling jobs that are delayed or reserved. So when using bredis workers, you have to have at least one redis worker as well.

Note: bredis queue driver is 100% compatible with redis driver. In other words, you may push the jobs using redis driver and pop them using bredis, or vice versa.