/**
  * {@inheritDoc}
  */
 public function delete(QueueInterface $queue)
 {
     $this->redis->multi();
     $this->redis->llen($this->getRedisKey($queue));
     $this->redis->del($this->getRedisKey($queue));
     $this->redis->srem('queues', $queue->getName());
     $responses = $this->redis->exec();
     if (isset($responses[0])) {
         return $responses[0];
     }
     return 0;
 }
 function it_deletes_queue_from_redis(QueueInterface $queue, RedisClientInterface $redis)
 {
     $queue->getName()->shouldBeCalled()->willReturn('high');
     $redis->multi()->shouldBeCalled();
     $redis->llen('queue:high')->shouldBeCalled();
     $redis->del('queue:high')->shouldBeCalled();
     $redis->srem('queues', 'high')->shouldBeCalled();
     $redis->exec()->shouldBeCalled()->willReturn(array(5));
     $this->delete($queue)->shouldReturn(5);
 }
Пример #3
0
 function it_fetches_number_of_failed_jobs_with_llen(RedisClientInterface $redis)
 {
     $redis->llen('failed')->shouldBeCalled()->willReturn(2);
     $this->count()->shouldReturn(2);
 }
Пример #4
0
 function it_can_count_pushed_jobs(RedisClientInterface $redis, QueueInterface $queue)
 {
     $queue->getName()->shouldBeCalled()->willReturn('foo');
     $redis->llen('queue:foo')->shouldBeCalled()->willReturn(2);
     $this->count($queue)->shouldReturn(2);
 }