\Disco\classesQueue

Queue class.

Allow simulation of parallel processing of jobs either immediatly or after a set delay. The classes objective is to allow large jobs that would cause lag or generally take a long time and are expensive in processing to be executed without interupting the applications response.

Summary

Methods
Properties
Constants
push()
jobs()
killJob()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

push()

push(  $job, integer  $delay,   $vars = null) 

Push a job onto the Queue for processing.

@param \Closure|string $job Either a \Closure to execute or a Class method pair like DB@query.

Parameters

$job
integer $delay

The delay to wait before begining execution of the $job. @param null|string|array $vars The variables to pass to the $job.

@return void

$vars

jobs()

jobs() : array

Get the jobs that are currently queued. Returns the jobs as objects structured like :

  • pId = process ID of job.
    • time = time job was enetered.
    • delay = delay the job was told to wait before execution.
    • object = the actual object or Closure that will execute the job.
    • method = the method to call on the object.
    • vars = the variables to be passed to the method.

Returns

array —

An array of job objects.

killJob()

killJob(integer  $pId) : boolean

Kill a Queued job by passing its process ID number

Parameters

integer $pId

The jobs process ID.

Returns

boolean —

Whether or not the job was killed.