ParametersInterface.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\Connection;
  11. /**
  12. * Interface defining a container for connection parameters.
  13. *
  14. * The actual list of connection parameters depends on the features supported by
  15. * each connection backend class (please refer to their specific documentation),
  16. * but the most common parameters used through the library are:
  17. *
  18. * @property-read string scheme Connection scheme, such as 'tcp' or 'unix'.
  19. * @property-read string host IP address or hostname of Redis.
  20. * @property-read int port TCP port on which Redis is listening to.
  21. * @property-read string path Path of a UNIX domain socket file.
  22. * @property-read string alias Alias for the connection.
  23. * @property-read float timeout Timeout for the connect() operation.
  24. * @property-read float read_write_timeout Timeout for read() and write() operations.
  25. * @property-read bool async_connect Performs the connect() operation asynchronously.
  26. * @property-read bool tcp_nodelay Toggles the Nagle's algorithm for coalescing.
  27. * @property-read bool persistent Leaves the connection open after a GC collection.
  28. * @property-read string password Password to access Redis (see the AUTH command).
  29. * @property-read string database Database index (see the SELECT command).
  30. *
  31. * @author Daniele Alessandri <suppakilla@gmail.com>
  32. */
  33. interface ParametersInterface
  34. {
  35. /**
  36. * Checks if the specified parameters is set.
  37. *
  38. * @param string $parameter Name of the parameter.
  39. *
  40. * @return bool
  41. */
  42. public function __isset($parameter);
  43. /**
  44. * Returns the value of the specified parameter.
  45. *
  46. * @param string $parameter Name of the parameter.
  47. *
  48. * @return mixed|null
  49. */
  50. public function __get($parameter);
  51. /**
  52. * Returns an array representation of the connection parameters.
  53. *
  54. * @return array
  55. */
  56. public function toArray();
  57. }