PHP Класс WpGears\Gearman\Worker

Наследование: extends WpGears\Worker
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$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