You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Connects to a Redis instance or reuse a connection already established with pconnect/popen.
37
+
*
38
+
* The connection will not be closed on close or end of request until the php process ends. So be patient on to many open FD's (specially on redis server side) when using persistent connections on many servers connecting to one redis server.
39
+
*
40
+
* Also more than one persistent connection can be made identified by either host + port + timeout or unix socket + timeout.
41
+
*
42
+
* This feature is not available in threaded versions. pconnect and popen then working like their non persistent equivalents.
43
+
*
44
+
* @param string $host can be a host, or the path to a unix domain socket
45
+
* @param int $port optional
46
+
* @param float $timeout value in seconds (optional, default is 0 meaning unlimited)
47
+
* @return bool TRUE on success, FALSE on error.
48
+
* @example $redis->connect('127.0.0.1', 6379);
49
+
* @example $redis->connect('127.0.0.1'); // port 6379 by default
* @param Redis::MULTI | Redis::PIPELINE Defaults to Redis::MULTI. A Redis::MULTI block of commands runs as a single transaction; a Redis::PIPELINE block is simply transmitted faster to the server, but without any guarantee of atomicity. discard cancels a transaction.
164
+
* @return multi() returns the Redis instance and enters multi-mode. Once in multi-mode, all subsequent method calls return the same object until exec() is called.
165
+
* @example
166
+
* $ret = $redis->multi()
167
+
* ->set('key1', 'val1')
168
+
* ->get('key1')
169
+
* ->set('key2', 'val2')
170
+
* ->get('key2')
171
+
* ->exec();
172
+
*
173
+
* //$ret == array (
174
+
* // 0 => TRUE,
175
+
* // 1 => 'val1',
176
+
* // 2 => TRUE,
177
+
* // 3 => 'val2');
178
+
*/
179
+
publicfunctionmulti() {}
180
+
181
+
/**
182
+
* @see multi()
183
+
*/
184
+
publicfunctionexec() {}
185
+
186
+
/**
187
+
* @see multi()
188
+
*/
189
+
publicfunctiondiscard() {}
190
+
191
+
/**
192
+
* Watches a key for modifications by another client. If the key is modified between WATCH and EXEC, the MULTI/EXEC transaction will fail (return FALSE). unwatch cancels all the watching of all keys by this client.
193
+
* @param string | array $key: a list of keys
194
+
* @return void
195
+
* @example
196
+
* $redis->watch('x');
197
+
* // long code here during the execution of which other clients could well modify `x`
198
+
* $ret = $redis->multi()
199
+
* ->incr('x')
200
+
* ->exec();
201
+
* // $ret = FALSE if x has been modified between the call to WATCH and the call to EXEC.
202
+
*/
203
+
publicfunctionwatch($key) {}
204
+
205
+
/**
206
+
* @see watch()
207
+
*/
208
+
publicfunctionunwatch() {}
209
+
210
+
/**
211
+
* Subscribe to channels. Warning: this function will probably change in the future.
212
+
*
213
+
* @param array $channels an array of channels to subscribe to
214
+
* @param string | array $callback either a string or an array($instance, 'method_name'). The callback function receives 3 parameters: the redis instance, the channel name, and the message.
215
+
* @example
216
+
* function f($redis, $chan, $msg) {
217
+
* switch($chan) {
218
+
* case 'chan-1':
219
+
* ...
220
+
* break;
221
+
*
222
+
* case 'chan-2':
223
+
* ...
224
+
* break;
225
+
*
226
+
* case 'chan-2':
227
+
* ...
228
+
* break;
229
+
* }
230
+
* }
231
+
*
232
+
* $redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans
233
+
*/
234
+
publicfunctionsubscribe($channels, $callback) {}
235
+
236
+
/**
237
+
* Publish messages to channels. Warning: this function will probably change in the future.
0 commit comments