-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a really basic example implementation
Finally have the (extremely) basic version working
- Loading branch information
1 parent
b482871
commit 5c2ffca
Showing
5 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Presque\Example; | ||
|
||
class SimpleJob | ||
{ | ||
public function perform($path) | ||
{ | ||
file_put_contents( | ||
$path, | ||
sprintf('Run at %s!', date('Y-m-d H:i:s')) . PHP_EOL, | ||
FILE_APPEND | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
$loader = require_once __DIR__.'/../vendor/autoload.php'; | ||
$loader->add('Presque\\Example', __DIR__); | ||
|
||
$connection = new Predis\Client('tcp://maureen.local:6379'); | ||
|
||
$storage = new Presque\Storage\PredisStorage($connection, 'presque'); | ||
|
||
$queue = new Presque\Queue('example', $storage); | ||
|
||
$worker = new Presque\Worker(); | ||
$worker->addQueue($queue); | ||
|
||
if (count($argv) > 1) { | ||
$queue->enqueue(Presque\Job::create('Presque\Example\SimpleJob', array($argv[1]))); | ||
} else { | ||
$worker->start(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters