Skip to content

Commit cc0c107

Browse files
authored
Merge pull request ukko#41 from alexander-schranz/patch-1
Added missing arguments for connect, pconnect and popen
2 parents c4cc6ca + 280ba13 commit cc0c107

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

src/Redis.php

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ public function __construct( ) {}
8989
/**
9090
* Connects to a Redis instance.
9191
*
92-
* @param string $host can be a host, or the path to a unix domain socket
93-
* @param int $port optional
94-
* @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited)
95-
* @param null $reserved should be null if $retry_interval is specified
96-
* @param int $retry_interval retry interval in milliseconds.
97-
* @return bool TRUE on success, FALSE on error.
92+
* @param string $host can be a host, or the path to a unix domain socket
93+
* @param int $port optional
94+
* @param float $timeout value in seconds (optional, default is 0.0 meaning unlimited)
95+
* @param null $reserved should be null if $retry_interval is specified
96+
* @param int $retry_interval retry interval in milliseconds.
97+
* @param float $read_timeout value in seconds (optional, default is 0 meaning unlimited)
98+
* @return bool TRUE on success, FALSE on error.
9899
* @example
99100
* <pre>
100101
* $redis->connect('127.0.0.1', 6379);
@@ -103,7 +104,7 @@ public function __construct( ) {}
103104
* $redis->connect('/tmp/redis.sock'); // unix domain socket.
104105
* </pre>
105106
*/
106-
public function connect( $host, $port = 6379, $timeout = 0.0, $reserved = null, $retry_interval = 0 ) {}
107+
public function connect( $host, $port = 6379, $timeout = 0.0, $reserved = null, $retry_interval = 0, $read_timeout = 0.0 ) {}
107108

108109
/**
109110
* A method to determine if a phpredis object thinks it's connected to a server
@@ -118,8 +119,10 @@ public function isConnected() {}
118119
* @param float $timeout
119120
* @param null $reserved
120121
* @param int $retry_interval
122+
* @param float $read_timeout
123+
* @return bool
121124
*/
122-
public function open( $host, $port = 6379, $timeout = 0.0, $reserved = null, $retry_interval = 0 ) {}
125+
public function open( $host, $port = 6379, $timeout = 0.0, $reserved = null, $retry_interval = 0, $read_timeout = 0.0 ) {}
123126

124127
/**
125128
* Connects to a Redis instance or reuse a connection already established with pconnect/popen.
@@ -129,26 +132,27 @@ public function open( $host, $port = 6379, $timeout = 0.0, $reserved = null, $re
129132
* many servers connecting to one redis server.
130133
*
131134
* Also more than one persistent connection can be made identified by either host + port + timeout
132-
* or unix socket + timeout.
135+
* or host + persistent_id or unix socket + timeout.
133136
*
134137
* This feature is not available in threaded versions. pconnect and popen then working like their non persistent
135138
* equivalents.
136139
*
137-
* @param string $host can be a host, or the path to a unix domain socket
138-
* @param int $port optional
139-
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
140-
* @param string $persistent_id unique identifier string for the connection
141-
* @param int $retry_interval retry time in milliseconds
142-
* @return bool TRUE on success, FALSE on error.
143-
* @example
140+
* @param string $host can be a host, or the path to a unix domain socket
141+
* @param int $port optional
142+
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
143+
* @param string $persistent_id identity for the requested persistent connection
144+
* @param int $retry_interval retry interval in milliseconds.
145+
* @param float $read_timeout value in seconds (optional, default is 0 meaning unlimited)
146+
* @return bool TRUE on success, FALSE on ertcnror.
144147
* <pre>
145-
* $redis->connect('127.0.0.1', 6379);
146-
* $redis->connect('127.0.0.1'); // port 6379 by default
147-
* $redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
148-
* $redis->connect('/tmp/redis.sock'); // unix domain socket.
148+
* $redis->pconnect('127.0.0.1', 6379);
149+
* $redis->pconnect('127.0.0.1'); // port 6379 by default - same connection like before.
150+
* $redis->pconnect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout and would be another connection than the two before.
151+
* $redis->pconnect('127.0.0.1', 6379, 2.5, 'x'); // x is sent as persistent_id and would be another connection than the three before.
152+
* $redis->pconnect('/tmp/redis.sock'); // unix domain socket - would be another connection than the four before.
149153
* </pre>
150154
*/
151-
public function pconnect( $host, $port = 6379, $timeout = 0.0, $persistent_id = '', $retry_interval = 0 ) {}
155+
public function pconnect( $host, $port = 6379, $timeout = 0.0, $persistent_id = null, $retry_interval = 0, $read_timeout = 0.0 ) {}
152156

153157
/**
154158
* @see pconnect()
@@ -157,8 +161,10 @@ public function pconnect( $host, $port = 6379, $timeout = 0.0, $persistent_id =
157161
* @param float $timeout
158162
* @param string $persistent_id
159163
* @param int $retry_interval
164+
* @param float $read_timeout
165+
* @return bool
160166
*/
161-
public function popen( $host, $port = 6379, $timeout = 0.0, $persistent_id = '', $retry_interval = 0 ) {}
167+
public function popen( $host, $port = 6379, $timeout = 0.0, $persistent_id = '', $retry_interval = 0, $read_timeout = 0.0 ) {}
162168

163169
/**
164170
* Disconnects from the Redis instance, except when pconnect is used.

0 commit comments

Comments
 (0)