Skip to content

Commit ffc8049

Browse files
committed
updating the README
1 parent b5ed52d commit ffc8049

File tree

2 files changed

+50
-60
lines changed

2 files changed

+50
-60
lines changed

README

Lines changed: 0 additions & 60 deletions
This file was deleted.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Net Gearman
2+
3+
## About
4+
5+
Net_Gearman is a package for interfacing with Gearman. Gearman is a system to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance lots of function calls, or to call functions between languages.
6+
7+
## Installation
8+
9+
```
10+
$ composer require brianlmoon/net_gearman
11+
```
12+
13+
## Examples
14+
15+
### Client
16+
17+
```
18+
$client = new Net_Gearman_Client("localhost");
19+
$set = new Net_Gearman_Set();
20+
$task = new Net_Gearman_Task("Reverse_String", "foobar");
21+
$task->attachCallback(
22+
function($func, $handle, $result){
23+
print_r($result)
24+
}
25+
);
26+
$set->addTask($task);
27+
$client->runSet($set, $timeout);
28+
```
29+
30+
### Job
31+
32+
```
33+
class Reverse_String extends Net_Gearman_Job_Common {
34+
35+
public function run($workload) {
36+
$result = strrev($workload);
37+
return $result;
38+
}
39+
}
40+
```
41+
42+
### Worker
43+
44+
For easiest use, use GearmanManager for running workers. See: https://github.com/brianlmoon/GearmanManager
45+
46+
```
47+
$worker = new Net_Gearman_Worker('localhost');
48+
$worker->addAbility('Reverse_String');
49+
$worker->beginWork();
50+
```

0 commit comments

Comments
 (0)