Documentation

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

$destroy

protected Closure $destroy

Closure that will be used before a worker is getting destroyed

$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
throws
Exception

in case of a processing Error an Exception will be thrown

onProcessDestroy()

Before the worker process is getting destroyed

public onProcessDestroy() : mixed
Tags
throws
Exception

in case of a processing Error an Exception will be thrown

run()

run the work

public run(Serializable $input) : Serializable
Parameters
$input : Serializable

the data, that the worker should process

Tags
throws
Exception

in case of a processing Error an Exception will be thrown

Return values
Serializable

Returns the result


        
On this page

Search results