Search by

gecole / queue-redis

ecoleplus

Redis queue driver for the Gecole framework, shipped as an optional package so the core stays dependency-free.

Package info

gitlab.com/gecole/queue-redis

Issues

pkg:composer/gecole/queue-redis

Statistics

Installs: 3

Dependents: 0

Suggesters: 1

Stars: 0

dev-master 2026-11-07 09:33 UTC

This package is auto-updated.

Last update: 2026-11-07 09:36:51 UTC


README

An optional Redis queue driver for the Gecole framework. The framework core stays dependency-free; install this package when a deployment wants Redis-backed queues.

composer require gecole/queue-redis
composer require predis/predis        # or install the native php-redis extension

Enable

Register the provider and add a redis queue connection:

// config/app.php
'providers' => [ /* …, */ \Gecole\Queue\Redis\QueueRedisServiceProvider::class ],

// config/queue.php
'default' => env('QUEUE_CONNECTION', 'database'),

'connections' => [
    'redis' => [
        'driver' => 'redis',
        'queue' => 'default',
        'retry_after' => 90,
        'tries' => 3,
        'backoff' => 0,
        'timeout' => 60,
        'prefix' => 'gecole:queue:',
        'redis' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'port' => (int) env('REDIS_PORT', 6379),
            'username' => (string) env('REDIS_USERNAME', ''),
            'password' => (string) env('REDIS_PASSWORD', ''),
            'database' => (int) env('REDIS_DB', 0),
            'timeout' => (float) env('REDIS_TIMEOUT', '1.0'),
        ],
    ],
],

Then run the normal worker:

php bin/console queue:work redis

The same queue:work, queue:failed, queue:retry, queue:flush and queue:clear commands work; the failed-job commands use the Redis failed hash.

Storage

KeyShape
prefix + queueready list
prefix + queue + :delayeddelayed zset (score = available_at)
prefix + queue + :reservedreserved zset (score = retry_at)
prefix + failedfailed hash (id → JSON record)

A reserved job returns to the ready list after retry_after seconds if a worker dies; payload attempts are preserved across retries. queue:clear deletes the ready, delayed and reserved structures for one queue.

Batches work unchanged because they are implemented over the generic Queue contract.

Client

RedisQueue::fromConfig() uses ext-redis when available, otherwise Predis\Client. The package has no hard dependency on either; see composer suggest.

Tests

composer test
# or:
FRAMEWORK_AUTOLOAD=/path/to/gecole-framework/vendor/autoload.php php tests/run.php

The test suite uses an in-memory fake client and does not need a Redis daemon.