Download the PHP package fair/queue without Composer
On this page you can find all versions of the php package fair/queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package queue
Fast messages/jobs queue with fair distribution
Shipped with PhpRedis BrokerInterface implementation.
Every message/job pushed into a queue has the fair-tag used to handle the message processing fairly, like so:
Requirements
- PHP: ^8.1
- Redis: ^5
- PhpRedis
Basic features
- Fair messages distribution based on arbitrary string fair-tag
- Messages with same fair-tag are handled in order of pushing
- Pushing complexity: O(1)
- Popping complexity: O(1) if there are no empty queues; O(m) where m is a number of empty (not all) queues (they are getting removed during pop operation)
- Zero latency blocking popping support (forget about
sleep(1);
) - Endless flexibility: add as many workers as many connections your Redis instance can handle
Blocking VS Non-blocking pop
Non-blocking pop
- returns
NULL
immediately if a queue is empty.
Blocking pop
- returns a message immediately, if any.
- else: waits for a new message for up to
float
timeout - returns
NULL
if there are no new messages when time is up, or returns a new message immediately (without waiting for the timeout to time up) if a new message appears.
Full working example
Testing
There is docker-compose.yaml for testing/development/experiments.
All versions of queue with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
ext-redis Version *
ext-redis Version *
The package fair/queue contains the following files
Loading the files please wait ....