PHP Class WpGears\Gearman\Client

Inheritance: extends WpGears\Client
Mostra file Open project: 10up/wp-gears

Public Properties

Property Type Description
$gearman_client The libGearman Client instance
$gearman_servers The list of Gearman Servers to connect to.

Public Methods

Method Description
add ( string $hook, array $args = [], string $priority = 'normal' ) : boolean Adds a Job to the libGearman Client's Queue.
get_async_group ( ) : string The Function Group used to split libGearman functions on a multi-network install.
get_background_method ( string $priority ) : string Returns the libGearman function to use based on the specified priority.
get_blog_id ( ) : integer | false Caches and returns the current blog id for adding to the Job meta data. False if not a multisite install.
get_gearman_client ( ) : GearmanClient | false Builds the libGearman Client 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 new libGearman Client instances and configures the servers that it should connect to.

Method Details

add() public method

Adds a Job to the libGearman Client's Queue.
public add ( string $hook, array $args = [], string $priority = 'normal' ) : boolean
$hook string The action hook name for the job
$args array Optional arguments for the job
$priority string Optional priority of the job
return boolean true or false depending on the Client

get_async_group() public method

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

get_background_method() public method

Returns the libGearman function to use based on the specified priority.
public get_background_method ( string $priority ) : string
$priority string low, normal or high
return string The corresponding method name

get_blog_id() public method

Caches and returns the current blog id for adding to the Job meta data. False if not a multisite install.
public get_blog_id ( ) : integer | false
return integer | false The current blog ids id.

get_gearman_client() public method

Builds the libGearman Client Instance if the extension is installed. Once created returns the previous instance without reinitialization.
public get_gearman_client ( ) : GearmanClient | false
return GearmanClient | false An instance of GearmanClient

get_servers() public method

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

register() public method

Creates a new libGearman Client instances and configures the servers that it should connect to.
public register ( ) : boolean
return boolean True or false if successful

Property Details

$gearman_client public_oe property

The libGearman Client instance
public $gearman_client

$gearman_servers public_oe property

The list of Gearman Servers to connect to.
public $gearman_servers