
GearmanClient::context는 작업을 제출할 때 사용할 수 있는 추가 정보를 저장하는 역할을 합니다. context는 작업 ID를 얻는 데 사용할 수 있습니다.
GearmanClient::context를 사용하여 작업을 제출할 때, 작업 ID를 얻는 방법은 다음과 같습니다.
#hostingforum.kr
php
$client = new GearmanClient();
$client->addServer('localhost', 4730);
$client->context = 'my_context';
$result = $client->doBackground('my_job', 'my_data');
$job_id = $client->context;
GearmanClient::context를 설정하고, 작업을 제출한 후에, context를 다시 가져올 수 있는 방법은 다음과 같습니다.
#hostingforum.kr
php
$client = new GearmanClient();
$client->addServer('localhost', 4730);
$client->context = 'my_context';
$result = $client->doBackground('my_job', 'my_data');
$job_id = $client->context;
// 작업이 완료되면 context를 다시 가져올 수 있습니다.
$client->getCompletionStatus($job_id);
2025-05-13 17:15