gearman可以实现:
1 语言间的通信
2 分布式任务的调度
gearman的原理
gearman 的详细说明:
http://www.cnblogs.com/cocowool/archive/2011/08/18/2145144.html
http://blog.163.com/lgh_2002/blog/static/44017526201281394856306/
gearman worker:
$worker = new GearmanWorker();
$worker->addServer("127.0.0.1", 4730);
$worker->addFunction( "upper", array(new MyClass(), "toUpper"));
while($worker->work());
class MyClass{
public function toUpper($job){
return strtoupper($job->workload());
}
}
gearman client:
echo "client test:";
$client = new GearmanClient();
$client->addServer('127.0.0.1', 4730);
echo $client->do('upper', "hi beck");