ProtocolProcessorInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\Protocol;
  11. use Predis\Command\CommandInterface;
  12. use Predis\Connection\CompositeConnectionInterface;
  13. /**
  14. * Defines a pluggable protocol processor capable of serializing commands and
  15. * deserializing responses into PHP objects directly from a connection.
  16. *
  17. * @author Daniele Alessandri <suppakilla@gmail.com>
  18. */
  19. interface ProtocolProcessorInterface
  20. {
  21. /**
  22. * Writes a request over a connection to Redis.
  23. *
  24. * @param CompositeConnectionInterface $connection Redis connection.
  25. * @param CommandInterface $command Command instance.
  26. */
  27. public function write(CompositeConnectionInterface $connection, CommandInterface $command);
  28. /**
  29. * Reads a response from a connection to Redis.
  30. *
  31. * @param CompositeConnectionInterface $connection Redis connection.
  32. *
  33. * @return mixed
  34. */
  35. public function read(CompositeConnectionInterface $connection);
  36. }