Simple PHP message queue with Memcached backend.
You can use a Memcached server as backend for a message queue with this very simple class. Class also allows consumers to post replies to message posters.
$mq = new Memqueue('memacached.server.address',11211);
$mq->push('queueName',$data);
$mq = new Memqueue('memacached.server.address',11211);
$data = $mq->pop('queueName');
$mq = new Memqueue('memacached.server.address',11211);
$data = $mq->pop('queueName',$mid);
// process the data
// ...
// Send back a reply
$mq->reply('queueName, $mid, $reply);
$mq = new Memqueue('memacached.server.address',11211);
$mid = $mq->push('queueName',$data);
// Wait for execution
while(! $mq->is_processed('queueName', $mid)) {
sleep(1);
}
$reply = $mq->getReply('queueName', $mid);