1. Go to this page and download the library: Download insolita/circular-queue library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$q = new CircularQueue(
'queueName',
new AsIsConverter(), // insolita\cqueue\Contracts\PayloadConverterInterface
new OnEmptyQueueException(), // insolita\cqueue\Contracts\EmptyQueueBehaviorInterface
new PredisStorage(new Client()) // insolita\cqueue\Contracts\StorageInterface
);
$q->fill(['alpha', 'beta', 'gamma', 'delta']);
$item = $q->pull(); //alpha - extract item from queue
$q->resume($item); // resume item in queue
$item1 = $q->pull(60); //Item will be resumed in queue after 60 seconds
$item2 = $q->pull();
$q->resume($item2, 120); //Item will be resumed in queue after 120 seconds
$item3 = $q->pull();
$q->resumeAt($item3, time()+100500); //Item will be resumed after concrete timestamp
$q->countTotal() //4
$q->countQueued() //1
$q->countDelayed() //3
$q->listDelayed() // ['beta', 'gamma', 'delta']
$q->resumeAllDelayed(); //Force resume all delayed in queue
$q->purgeDelayed(); //Remove all delayed
$q1 = new CircularQueue(
'firstQueue',
new SerializableConverter(),
new OnEmptyQueueException(),
new PhpRedisStorage(new \Redis())
);
$manager = new Manager([$q1]);
$manager->add(new CircularQueue(
'secondQueue',
new SerializableConverter(),
new OnEmptyQueueException(),
new PhpRedisStorage(new \Redis())
));
$manager->has('secondQueue'); //true
$manager->has('fooQueue'); //false
$manager->queue('firstQueue')->fill([...]);
$manager->queue('secondQueue')->fill([...]);
...
$manager->remove('firstQueue');
$manager->remove('secondQueue');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.