示例#1
0
 public function run()
 {
     $queue = new \Jenner\SimpleFork\Queue\RedisQueue('127.0.0.1', 6379, 1);
     for ($i = 0; $i < 100000; $i++) {
         $queue->put(getmypid() . '-' . mt_rand(0, 1000));
     }
     $queue->close();
 }
 public function testCommunication()
 {
     if (!extension_loaded("Redis")) {
         $this->markTestSkipped("Redis extension is not loaded");
     }
     $process = new \Jenner\SimpleFork\Process(function () {
         $queue = new \Jenner\SimpleFork\Queue\RedisQueue();
         $queue->put('test');
         $queue->close();
     });
     $process->start();
     $process->wait();
     $queue = new \Jenner\SimpleFork\Queue\RedisQueue();
     $this->assertEquals($queue->size(), 1);
     $this->assertEquals($queue->get(), 'test');
     $queue->close();
 }