Skip to content

Instantly share code, notes, and snippets.

@hjr3
Created January 24, 2012 23:38
Show Gist options
  • Save hjr3/1673522 to your computer and use it in GitHub Desktop.
Save hjr3/1673522 to your computer and use it in GitHub Desktop.
Simple Gearman worker example using anonymous functions
<?php
$gmw = new GearmanWorker();
$gmw->addServer();
$processor = new Processor;
$gmw->addFunction("process", function(GearmanJob $job) {
$data = json_decode($job->workload());
$processor->process($data);
});
while(1) $gmw->work();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment