PHP 클래스 WpGears\Gearman\Worker

상속: extends WpGears\Worker
파일 보기 프로젝트 열기: 10up/wp-gears

공개 프로퍼티들

프로퍼티 타입 설명
$gearman_servers The list of Gearman servers.
$gearman_worker The libGearman Worker instance

공개 메소드들

메소드 설명
do_job ( array $job ) : boolean Executes a Job pulled from Gearman. On a multisite instance it switches to the target site before executing the job. And the site is restored once executing is finished.
get_async_group ( ) : string The Function Group used to split libGearman functions on a multi-network install.
get_gearman_worker ( ) : GearmanWorker | false Builds the libGearman Worker Instance if the extension is installed. Once created returns the previous instance without reinitialization.
get_servers ( ) : array The Gearman Servers to connect to as defined in wp-config.php.
register ( ) : boolean Creates a Gearman Worker and initializes the servers it should connect to. The callback that will execute a job's hook is also setup here.
work ( ) : boolean Pulls a job from the Gearman Queue and tries to execute it.

메소드 상세

do_job() 공개 메소드

The job data contains, 1. hook - The name of the target hook to execute 2. args - Optional arguments to pass to the target hook 3. blog_id - Optional blog on a multisite to switch to, before execution Actions are fired before and after execution of the target hook. Eg:- for the action 'foo' The order of execution of actions is, 1. wp_async_task_before_job 2. wp_async_task_before_job_foo 3. foo 4. wp_async_task_after_job 5. wp_async_task_after_job_foo
public do_job ( array $job ) : boolean
$job array The job object data.
리턴 boolean True or false based on the status of execution

get_async_group() 공개 메소드

The Function Group used to split libGearman functions on a multi-network install.
public get_async_group ( ) : string
리턴 string The prefixed group name

get_gearman_worker() 공개 메소드

Builds the libGearman Worker Instance if the extension is installed. Once created returns the previous instance without reinitialization.
public get_gearman_worker ( ) : GearmanWorker | false
리턴 GearmanWorker | false An instance of GearmanWorker

get_servers() 공개 메소드

If absent the default server will be used.
public get_servers ( ) : array
리턴 array The list of servers for this Worker.

register() 공개 메소드

Creates a Gearman Worker and initializes the servers it should connect to. The callback that will execute a job's hook is also setup here.
public register ( ) : boolean
리턴 boolean True if operation was successful else false.

work() 공개 메소드

Errors are logged if the Job failed to execute.
public work ( ) : boolean
리턴 boolean True if the job could be executed, else false

프로퍼티 상세

$gearman_servers 공개적으로 프로퍼티

The list of Gearman servers.
public $gearman_servers

$gearman_worker 공개적으로 프로퍼티

The libGearman Worker instance
public $gearman_worker