Download the PHP package robsonalvesbh/semaphoro without Composer
On this page you can find all versions of the php package robsonalvesbh/semaphoro. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robsonalvesbh/semaphoro
More information about robsonalvesbh/semaphoro
Files in robsonalvesbh/semaphoro
Package semaphoro
Short Description This library will help you to run multiple process with PHP.
License
Homepage https://github.com/robsonalvesbh/semaphoro
Informations about the package semaphoro
Semaphoro
This library will help you to run multiple process with PHP.
Semaphoro library performs the orchestration of the processes avoiding that two or more workers that are running in parallel run the same processes, avoiding duplication of processes and still have a contingency to process again in case some process fails.
How to use
Set a storage
Parameters
- Predis/Client $redisClient - required
- String $prefix - optional (default value: semaphoro)
prefix is a namespace for redis.
Set a handler
Parameters
- StorageInterface $storage - required
- int $rangeLength - optional (default value: 50)
rangeLength is the quantity of process in a range
The RangeHandler is projected to work with incremental numbers like ID
Get semaphoro
Parameters
- HandlerInterface $handler - required
Methods
getAvailableProcess()
Get the next range available
return
- ProcessInterface
setUnprocessed()
Set unprocessed status when occurring an error
Parameters
- ProcessInterface $process - required
return
- void
remove()
Remove process from semaphoro when the process is finished
Parameters
- ProcessInterface $process - required
return
- void