ParametersInterface.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 for classes providing their own logic 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. * @return bool
  40. */
  41. public function __isset($parameter);
  42. /**
  43. * Returns the value of the specified parameter.
  44. *
  45. * @param string $parameter Name of the parameter.
  46. * @return mixed
  47. */
  48. public function __get($parameter);
  49. /**
  50. * Returns an array representation of the connection parameters.
  51. *
  52. * @return array
  53. */
  54. public function toArray();
  55. }