PHP 클래스 Resque\Job

파일 보기 프로젝트 열기: mjphaynes/php-resque 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$class The classname this job
$completeStatuses of statuses that are considered final/complete
$data The data/arguments for the job
$id The ID of this job
$instance Instance of the class performing work for this job
$method The method name for this job
$payload The payload sent through for this job
$queue The name of the queue that this job belongs to
$redis The Redis instance
$worker Instance of the worker running this job

공개 메소드들

메소드 설명
__construct ( string $queue, string $id, string $class, array $data = null ) Create a new job
__toString ( ) : string Generate a string representation of this object
cancel ( ) Mark the current job as cancelled
cleanup ( array $queues = ['*'] ) Look for any jobs which are running but the worker is dead.
complete ( ) Mark the current job as complete
create ( string $queue, string $class, array $data = null, integer $run_at ) : string Create a new job and save it to the specified queue.
createId ( string $queue, string $class, array $data = null, integer $run_at ) : string Create a new job id
delay ( integer $time ) : boolean Save the job to Redis delayed queue
execTime ( ) : string Returns formatted execution time string
execTimeStr ( ) : string Returns formatted execution time string
fail ( Exception $e ) Mark the current job as having failed
failError ( ) : mixed Returns the fail error for the job
getClass ( ) : string Get the job class.
getData ( ) : array Get the job data.
getDelayedTime ( ) : integer Get the job delayed time
getId ( ) : string Get the job id.
getInstance ( ) : object Get the instantiated object for this job that will be performing work
getPacket ( ) : array Fetch the packet for the job being monitored.
getQueue ( ) : string Get the job queue.
getStatus ( ) : integer Fetch the status for the job
getWorker ( ) : Worker Get the queue worker interface
load ( string $id ) : string Load a job from id
loadPayload ( string $queue, string $payload ) : string Load a job from the Redis payload
perform ( ) : boolean Perform the job
queue ( ) : boolean Save the job to Redis queue
redisKey ( Job $job, string $suffix = null ) : string Get the Redis key
run ( ) Mark the current job running
setClass ( ) Set the job class.
setData ( ) Set the job data.
setId ( ) Set the job id.
setQueue ( ) Set the job queue.
setStatus ( integer $status, Exception $e = null ) Update the status indicator for the current job with a new status
setWorker ( Worker $worker ) Set the queue worker interface
toArray ( ) : array Return array representation of this job

보호된 메소드들

메소드 설명
createPayload ( ) : string Create a payload string from the given job and data
stopped ( ) Mark the current job stopped This is an internal function as the job is either completed, cancelled or failed

메소드 상세

__construct() 공개 메소드

Create a new job
public __construct ( string $queue, string $id, string $class, array $data = null )
$queue string Queue to add job to
$id string Job id
$class string Job class to run
$data array Any Job data

__toString() 공개 메소드

Generate a string representation of this object
public __toString ( ) : string
리턴 string Representation of the current job status class

cancel() 공개 메소드

Mark the current job as cancelled
public cancel ( )

cleanup() 공개 정적인 메소드

Meaning that they are also not running but left in limbo This is a form of garbage collection to handle cases where the server may have been killed and the workers did not die gracefully and therefore leave state information in Redis.
public static cleanup ( array $queues = ['*'] )
$queues array list of queues to check

complete() 공개 메소드

Mark the current job as complete
public complete ( )

create() 공개 정적인 메소드

Create a new job and save it to the specified queue.
public static create ( string $queue, string $class, array $data = null, integer $run_at ) : string
$queue string The name of the queue to place the job in
$class string The name of the class that contains the code to execute the job
$data array Any optional arguments that should be passed when the job is executed
$run_at integer Unix timestamp of when to run the job to delay execution
리턴 string

createId() 공개 정적인 메소드

Create a new job id
public static createId ( string $queue, string $class, array $data = null, integer $run_at ) : string
$queue string The name of the queue to place the job in
$class string The name of the class that contains the code to execute the job
$data array Any optional arguments that should be passed when the job is executed
$run_at integer Unix timestamp of when to run the job to delay execution
리턴 string

createPayload() 보호된 메소드

Create a payload string from the given job and data
protected createPayload ( ) : string
리턴 string

delay() 공개 메소드

Save the job to Redis delayed queue
public delay ( integer $time ) : boolean
$time integer unix time of when to perform job
리턴 boolean success

execTime() 공개 메소드

Returns formatted execution time string
public execTime ( ) : string
리턴 string

execTimeStr() 공개 메소드

Returns formatted execution time string
public execTimeStr ( ) : string
리턴 string

fail() 공개 메소드

Mark the current job as having failed
public fail ( Exception $e )
$e Exception

failError() 공개 메소드

Returns the fail error for the job
public failError ( ) : mixed
리턴 mixed

getClass() 공개 메소드

Get the job class.
public getClass ( ) : string
리턴 string

getData() 공개 메소드

Get the job data.
public getData ( ) : array
리턴 array

getDelayedTime() 공개 메소드

Get the job delayed time
public getDelayedTime ( ) : integer
리턴 integer

getId() 공개 메소드

Get the job id.
public getId ( ) : string
리턴 string

getInstance() 공개 메소드

Get the instantiated object for this job that will be performing work
public getInstance ( ) : object
리턴 object Instance of the object that this job belongs to

getPacket() 공개 메소드

Fetch the packet for the job being monitored.
public getPacket ( ) : array
리턴 array

getQueue() 공개 메소드

Get the job queue.
public getQueue ( ) : string
리턴 string

getStatus() 공개 메소드

Fetch the status for the job
public getStatus ( ) : integer
리턴 integer Status as as an integer, based on the Job constants

getWorker() 공개 메소드

Get the queue worker interface
public getWorker ( ) : Worker
리턴 Worker

load() 공개 정적인 메소드

Load a job from id
public static load ( string $id ) : string
$id string The job id
리턴 string

loadPayload() 공개 정적인 메소드

Load a job from the Redis payload
public static loadPayload ( string $queue, string $payload ) : string
$queue string The name of the queue to place the job in
$payload string The payload that was stored in Redis
리턴 string

perform() 공개 메소드

Perform the job
public perform ( ) : boolean
리턴 boolean

queue() 공개 메소드

Save the job to Redis queue
public queue ( ) : boolean
리턴 boolean success

redisKey() 공개 정적인 메소드

Get the Redis key
public static redisKey ( Job $job, string $suffix = null ) : string
$job Job the job to get the key for
$suffix string to be appended to key
리턴 string

run() 공개 메소드

Mark the current job running
public run ( )

setClass() 공개 메소드

Set the job class.
public setClass ( )

setData() 공개 메소드

Set the job data.
public setData ( )

setId() 공개 메소드

Set the job id.
public setId ( )

setQueue() 공개 메소드

Set the job queue.
public setQueue ( )

setStatus() 공개 메소드

Update the status indicator for the current job with a new status
public setStatus ( integer $status, Exception $e = null )
$status integer The status of the job
$e Exception If failed status it sends through exception

setWorker() 공개 메소드

Set the queue worker interface
public setWorker ( Worker $worker )
$worker Worker

stopped() 보호된 메소드

Mark the current job stopped This is an internal function as the job is either completed, cancelled or failed
protected stopped ( )

toArray() 공개 메소드

Return array representation of this job
public toArray ( ) : array
리턴 array

프로퍼티 상세

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

The classname this job
protected $class

$completeStatuses 보호되어 있는 정적으로 프로퍼티

of statuses that are considered final/complete
protected static $completeStatuses

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

The data/arguments for the job
protected $data

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

The ID of this job
protected $id

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

Instance of the class performing work for this job
protected $instance

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

The method name for this job
protected $method

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

The payload sent through for this job
protected $payload

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

The name of the queue that this job belongs to
protected $queue

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

The Redis instance
protected $redis

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

Instance of the worker running this job
protected $worker