Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 61 | All time: 10,489 This week: 73![]() |
Version | License | PHP version | Categories | |||
circular-queue 1.0 | MIT/X Consortium ... | 7 | Databases, Tools, Data types, PHP 7 |
Description | Author | |
This package can manage circular job queues stored in Redis. |
Circular Queue with redis implementation for distribution of shared data Useful for resource balancing, parsing
composer require insolita/circular-queue
$q = new SimpleCircularQueue(
'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']);
$q->next(); //alpha
$q->next(); //beta
$q->next(); //gamma
$q->next(); //delta
$q->next(); //alpha
$q->next(); //beta
$q->next(); //gamma
$q->countQueued();//4
$q->purgeQueued();//clear queue
...
$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->queue('firstQueue')->fill([...]);
$manager->queue('secondQueue')->fill([...]);
...
$manager->remove('firstQueue');
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Documentation |
![]() |
/ | src |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
Class | Class source | ||
![]() |
Class | Class source | ||
![]() |
Class | Class source |
![]() |
/ | src | / | Behaviors |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | src | / | Contracts |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | src | / | Converters |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | src | / | Storage |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | tests | / | Functional |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | tests | / | Unit |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.