I'm trying to access the job_id of the current job from within my worker function so I can save the result to memcached under a key that equals the current worker function. Is there any way to accomplish this?
<?php
class Net_Gearman_Job_Example1 extends Net_Gearman_Job_Common{
public function run($arg){
echo 'job_started' . PHP_EOL;
var_dump($arg);
$CI =& get_instance();
$CI->load->library('memcached_library', 'memcached');
// RIGHT HERE I WOULD LIKE TO KNOW JOB_ID OF CURRENTLY RUNNING JOB
$CI->memcached->add();
sleep(2);
//return array('result' => 'finished', 'output' => 'some_output');
}
}
Got it, should have looks for this sooner. Net_Gearman_Job_Common has properties for $handle and $conn -- those were all I needed to do this.