本文整理匯總了PHP中GearmanClient::addTaskHigh方法的典型用法代碼示例。如果您正苦於以下問題:PHP GearmanClient::addTaskHigh方法的具體用法?PHP GearmanClient::addTaskHigh怎麽用?PHP GearmanClient::addTaskHigh使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GearmanClient
的用法示例。
在下文中一共展示了GearmanClient::addTaskHigh方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addTaskHigh
public function addTaskHigh($function_name, $workload, &$context = null, $unique = null)
{
$function_name = $this->_processFunctionName($function_name);
return parent::addTaskHigh($function_name, $workload, $context, $unique);
}
示例2: execute
/**
* Executes an asynchronous request using the driver
* method.
*
* // Execute the asynchronous request
* $driver->execute($request_async);
*
* @param Request_Async The asynchronous request to execute
* @return Request_Async
*/
public function execute(Request_Async $request_async)
{
// Assign the asynchronous request to this driver
$this->_request_async = $request_async;
// Foreach request
foreach ($request_async as $request) {
// Add the task to the job
$task = $this->_gearman_client->addTaskHigh('request_async', serialize($request), Request_Async_Gearman::$context);
$uuid = $task->unique();
$this->_requests[$uuid] = $request;
$this->_task_handles[] = $task;
$this->_complete[$uuid] = NULL;
}
// Run the tasks
$this->_gearman_client->runTasks();
// Return request async object
return $request_async;
}