FireAndForget.php 812 B

123456789101112131415161718192021222324252627282930313233343536
  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 Predis\Connection\ConnectionInterface;
  12. /**
  13. * Command pipeline that writes commands to the servers but discards responses.
  14. *
  15. * @author Daniele Alessandri <suppakilla@gmail.com>
  16. */
  17. class FireAndForget extends Pipeline
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. protected function executePipeline(ConnectionInterface $connection, \SplQueue $commands)
  23. {
  24. while (!$commands->isEmpty()) {
  25. $connection->writeRequest($commands->dequeue());
  26. }
  27. $connection->disconnect();
  28. return array();
  29. }
  30. }