PHPackages                             comradefuzz/catena - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. comradefuzz/catena

ActiveYii2-extension[Caching](/categories/caching)

comradefuzz/catena
==================

Redis based queued background jobs system

1.0.0(9y ago)07GPL-3.0+PHP

Since May 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/comradefuzz/catena)[ Packagist](https://packagist.org/packages/comradefuzz/catena)[ RSS](/packages/comradefuzz-catena/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Catena
======

[](#catena)

Redis based queued background jobs system inspired by `resque`

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist comradefuzz/catena "*"

```

or add

```
"comradefuzz/catena": "*"

```

to the require section of your `composer.json` file.

Attention
---------

[](#attention)

Module is in development mode and should not be used in production

Usage
-----

[](#usage)

Configure your application like following:

```
 'bootstrap' => ['catena'],
 'components' => [
    'queue' => 'comradefuzz\catena\components\Queue',
 ],
 'modules' => [
        'catena' => [
            'class' => 'comradefuzz\catena\Module',
            'autoRespawn' => false, // If set worker groups will be kept in actual state by respawning dead workers
                                    // (defaults `false`)
            'enableRegulars' => false,  // If this is set and `regularJobs` is not empty, jobs will be automatically set
                                        // to queues with specified interval (defaults `false`)
            'redis' => [
                // Redis connection
                'connection' => [
                    'class' => '\yii\redis\Connection',
                    'hostname' => 'redis',
                ],
                'namespace' => 'catena', // prefix all module data has (defaults to `catena`)
            ],
            // Worker groups configuration
            'workers' => [
                [
                    'queues' => 'harder', // define queues workers are listening to
                    'count' => 3, // specify workers count in group (more workers means faster processing)
                    'sleep' => 15, // number of seconds each worker sleeps if all jobs are done
                    'memoryLimit' => 3 * 1024 * 1024 // bytes of RAM allowed to use to each worker in group
                ],
                [
                    'queues' => 'better,stronger', // you can define several queues to worker group
                    'count' => 2
                ],
                ['queues' => 'faster'],
            ],
            'regularJobs' => [
                [
                    '\app\jobs\RegularJob', // Job class
                    'queue' => 'harder',    // Queue to place job
                    'args' => ['foo' => 'bar'], // Job arguments
                    'interval' => 15    // Interval in seconds in which job will be enqueued
                ],
                [
                    '\app\jobs\RegularJob',
                    'queue' => 'harder',
                    'args' => ['foo' => 'bazzz'],
                    'interval' => 15,
                    'descriptor' => 'another', // Allows to have several regular jobs of one class with different arguments
                ],
            ]
        ]
    ],

```

Define job class

```
