Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: abb0f91003
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (20 sloc) 0.557 kB
<?php
class Net_Gearman_Job_Sum extends Net_Gearman_Job_Common {
public static $cache = array();
public function run($workload) {
$hash = md5(json_encode($workload));
if(empty(self::$cache[$hash])){
$sum = 0;
foreach($workload as $d){
$sum+=$d;
sleep(1);
}
self::$cache[$hash] = $sum;
} else {
$sum = self::$cache[$hash];
}
GearmanPearManager::$LOG[] = "Answer: ".$sum;
return $sum;
}
}
?>
Jump to Line
Something went wrong with that request. Please try again.