PHP 클래스 PHPDaemon\Core\ComplexJob

저자: Vasily Zorin ([email protected])
상속: implements ArrayAccess, use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
파일 보기 프로젝트 열기: kakserpom/phpdaemon 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$jobs Hash of jobs [jobname -> callback, ...]
$jobsNum Number of jobs
$listeners Listeners [callable, ...]
$results Hash of results [jobname -> result, ...]
$resultsNum Number of results
$state Current state
$vars

보호된 프로퍼티들

프로퍼티 타입 설명
$backlog
$keep
$maxConcurrency
$more
$moreFirstFlag

공개 메소드들

메소드 설명
__construct ( callable $cb = null ) Constructor
__invoke ( mixed $name = null, callable $cb = null ) : void Adds new job or calls execute() method
addJob ( string $name, callable $cb ) : boolean Adds job
addListener ( callable $cb ) : void Adds listener
checkQueue ( ) : void Called automatically. Checks whether if the queue is full. If not, tries to pull more jobs from backlog and 'more'
cleanup ( ) : void Clean up
execute ( ) : void Runs the job
getResult ( string $jobname ) : mixed Get result
getResults ( ) : array Returns associative array of results
hasCompleted ( ) : boolean Has completed?
isQueueFull ( ) : boolean Returns whether or not the queue is full (maxConcurrency option exceed)
keep ( boolean $keep = true ) : void Keep
maxConcurrency ( integer $n ) : this Sets a limit of simultaneously executing tasks
more ( callable $cb = null ) : this Sets a callback which is going to be fired always when we have a room for more jobs
offsetExists ( string $j ) : boolean Handler of isset($job[$name])
offsetGet ( string $j ) : mixed Handler of $job[$name]
offsetSet ( string $j, mixed $v ) : void Handler of $job[$name] = $value
offsetUnset ( string $j ) : void Handler of unset($job[$name])
setResult ( string $jobname, mixed $result = null ) : boolean Set result

보호된 메소드들

메소드 설명
checkIfAllReady ( ) : void Checks if all jobs are ready

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( callable $cb = null )
$cb callable Listener

__invoke() 공개 메소드

Adds new job or calls execute() method
public __invoke ( mixed $name = null, callable $cb = null ) : void
$name mixed
$cb callable
리턴 void

addJob() 공개 메소드

Adds job
public addJob ( string $name, callable $cb ) : boolean
$name string Job name
$cb callable Callback
리턴 boolean Success

addListener() 공개 메소드

Adds listener
public addListener ( callable $cb ) : void
$cb callable Callback
리턴 void

checkIfAllReady() 보호된 메소드

Checks if all jobs are ready
protected checkIfAllReady ( ) : void
리턴 void

checkQueue() 공개 메소드

Called automatically. Checks whether if the queue is full. If not, tries to pull more jobs from backlog and 'more'
public checkQueue ( ) : void
리턴 void

cleanup() 공개 메소드

Clean up
public cleanup ( ) : void
리턴 void

execute() 공개 메소드

Runs the job
public execute ( ) : void
리턴 void

getResult() 공개 메소드

Get result
public getResult ( string $jobname ) : mixed
$jobname string Job name
리턴 mixed Result or null

getResults() 공개 메소드

Returns associative array of results
public getResults ( ) : array
리턴 array

hasCompleted() 공개 메소드

Has completed?
public hasCompleted ( ) : boolean
리턴 boolean

isQueueFull() 공개 메소드

Returns whether or not the queue is full (maxConcurrency option exceed)
public isQueueFull ( ) : boolean
리턴 boolean

keep() 공개 메소드

Keep
public keep ( boolean $keep = true ) : void
$keep boolean Keep?
리턴 void

maxConcurrency() 공개 메소드

Sets a limit of simultaneously executing tasks
public maxConcurrency ( integer $n ) : this
$n integer Natural number or -1 (no limit)
리턴 this

more() 공개 메소드

Sets a callback which is going to be fired always when we have a room for more jobs
public more ( callable $cb = null ) : this
$cb callable Callback
리턴 this

offsetExists() 공개 메소드

Handler of isset($job[$name])
public offsetExists ( string $j ) : boolean
$j string Job name
리턴 boolean

offsetGet() 공개 메소드

Handler of $job[$name]
public offsetGet ( string $j ) : mixed
$j string Job name
리턴 mixed

offsetSet() 공개 메소드

Handler of $job[$name] = $value
public offsetSet ( string $j, mixed $v ) : void
$j string Job name
$v mixed Job result
리턴 void

offsetUnset() 공개 메소드

Handler of unset($job[$name])
public offsetUnset ( string $j ) : void
$j string Job name
리턴 void

setResult() 공개 메소드

Set result
public setResult ( string $jobname, mixed $result = null ) : boolean
$jobname string Job name
$result mixed Result
리턴 boolean

프로퍼티 상세

$backlog 보호되어 있는 프로퍼티

protected $backlog

$jobs 공개적으로 프로퍼티

Hash of jobs [jobname -> callback, ...]
public $jobs

$jobsNum 공개적으로 프로퍼티

Number of jobs
public $jobsNum

$keep 보호되어 있는 프로퍼티

protected $keep

$listeners 공개적으로 프로퍼티

Listeners [callable, ...]
public $listeners

$maxConcurrency 보호되어 있는 프로퍼티

protected $maxConcurrency

$more 보호되어 있는 프로퍼티

protected $more

$moreFirstFlag 보호되어 있는 프로퍼티

protected $moreFirstFlag

$results 공개적으로 프로퍼티

Hash of results [jobname -> result, ...]
public $results

$resultsNum 공개적으로 프로퍼티

Number of results
public $resultsNum

$state 공개적으로 프로퍼티

Current state
public $state

$vars 공개적으로 프로퍼티

public $vars