/** * {@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_workers_from_redis(RedisClientInterface $redis, WorkerInterface $worker) { $worker->getId()->shouldBeCalled()->willReturn('local:789'); $redis->srem('workers', 'local:789')->shouldBeCalled()->willReturn(1); $redis->del('worker:local:789')->shouldBeCalled()->willReturn(1); $redis->del('worker:local:789:started')->shouldBeCalled()->willReturn(1); $this->delete($worker)->shouldReturn($this); }
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); }