FireAndForget.php 825 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Pipeline;
  11. use SplQueue;
  12. use Predis\Connection\ConnectionInterface;
  13. /**
  14. * Command pipeline that writes commands to the servers but discards responses.
  15. *
  16. * @author Daniele Alessandri <suppakilla@gmail.com>
  17. */
  18. class FireAndForget extends Pipeline
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. protected function executePipeline(ConnectionInterface $connection, SplQueue $commands)
  24. {
  25. while (!$commands->isEmpty()) {
  26. $connection->writeRequest($commands->dequeue());
  27. }
  28. $connection->disconnect();
  29. return array();
  30. }
  31. }