SuperClosureWorker
in package
implements
WorkerInterface
The Super Closure Worker Class
Table of Contents
Interfaces
- WorkerInterface
- The Interface for worker processes
Properties
- $create : Closure
- $destroy : Closure
- $semaphore : Semaphore
- $storage : ArrayObject
Methods
- __construct() : mixed
- The constructor
- onProcessCreate() : mixed
- After the worker has been forked into another process
- onProcessDestroy() : mixed
- Before the worker process is getting destroyed
- run() : Serializable
- run the work
Properties
$create
protected
Closure
$create
Closure that runs the task
$destroy
protected
Closure
$destroy
Closure that will be used before a worker is getting destroyed
$semaphore
protected
Semaphore
$semaphore
the semaphore to run synchronized tasks
$storage
protected
ArrayObject
$storage
persistent storage container for the working process
Methods
__construct()
The constructor
public
__construct([Closure $create = NULL ][, Closure $destroy = NULL ]) : mixed
Parameters
- $create : Closure = NULL
-
Closure that can be used when a worker has been forked
- $destroy : Closure = NULL
-
Closure that can be used before a worker is getting destroyed
onProcessCreate()
After the worker has been forked into another process
public
onProcessCreate(Semaphore $semaphore) : mixed
Parameters
- $semaphore : Semaphore
-
the semaphore to run synchronized tasks
Tags
onProcessDestroy()
Before the worker process is getting destroyed
public
onProcessDestroy() : mixed
Tags
run()
run the work
public
run(Serializable $input) : Serializable
Parameters
- $input : Serializable
-
the data, that the worker should process
Tags
Return values
Serializable —Returns the result