Skip to content

Instantly share code, notes, and snippets.

@ackintosh
Last active December 10, 2015 13:58
Show Gist options
  • Save ackintosh/4444078 to your computer and use it in GitHub Desktop.
Save ackintosh/4444078 to your computer and use it in GitHub Desktop.
<?php
// front.php
$options = array(
'name' => 'ack_queue',
'driverOptions' => array(
'host' => 'localhost',
'port' => '22133',
),
);
$queue = new ZendQueue\Queue('MemcacheQ', $options);
$queue->send('Hello, World!');
<?php
// worker.php
$options = array(
'name' => 'ack_queue',
'driverOptions' => array(
'host' => 'localhost',
'port' => '22133',
),
);
$queue = new ZendQueue\Queue('MemcacheQ', $options);
for (;;) {
$messages = $queue->receive(1);
foreach ($messages as $mess) if ($mess->body) echo $mess->body . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment