mirror of
https://github.com/predis/predis.git
synced 2026-08-27 06:09:52 +00:00
8277afc7a8
stream_socket_client() has the undocumented ability to open different persistent streams by providing a path in the $address string. Previously we supported this behaviour with a combination of "persistent" and "path" (see #139) but this can be confusing, especially now that we support the redis:// scheme which uses the path part of an URI string to specify a database number. After this change, instead of using an URI string such as: $parameters = 'tcp://127.0.0.1/first?persistent=1&database=5'; You should use the following ones: $parameters = 'tcp://127.0.0.1?persistent=first&database=5'; $parameters = 'redis://127.0.0.1/5?persistent=first'; Avoiding "path" makes even more sense when using array connection parameters: $parameters = [ 'host' => '127.0.0.1', 'database' => 5, 'persistent' => 'first', ] This feature is not supported when using UNIX domain sockets because the path trick of stream_socket_client() does not play well with the actual path of the socket file. The client will throw an InvalidArgumentException exception to notify the user. NOTE: unfortunately we have to disable the tests for persistent connections when running under HHVM due to a bug in their implementation of get_resource_type() preventing us to recognize a persistent stream from userland code.