8000 Update sentinel documentation to reflect changes to constructor in 6.… · phpredis/phpredis@849bedb · GitHub
[go: up one dir, main page]

Skip to content

Commit 849bedb

Browse files
authored
Update sentinel documentation to reflect changes to constructor in 6.0 release
1 parent 5bd3138 commit 849bedb

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

sentinel.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,42 @@ Redis Sentinel also provides other collateral tasks such as monitoring, notifica
2121
##### *Example*
2222

2323
~~~php
24-
$sentinel = new RedisSentinel('127.0.0.1'); // default parameters
25-
$sentinel = new RedisSentinel('127.0.0.1', 26379, 2.5); // 2.5 sec timeout.
26-
$sentinel = new RedisSentinel('127.0.0.1', 26379, 0, 'sentinel'); // persistent connection with id 'sentinel'
27-
$sentinel = new RedisSentinel('127.0.0.1', 26379, 0, ''); // also persistent connection with id ''
28-
$sentinel = new RedisSentinel('127.0.0.1', 26379, 1, null, 100); // 1 sec timeout, 100ms delay between reconnection attempts.
29-
$sentinel = new RedisSentinel('127.0.0.1', 26379, 0, NULL, 0, 0, "secret"); // connect sentinel with password authentication
24+
$sentinel = new RedisSentinel([
25+
'host' => '127.0.0.1',
26+
]); // default parameters
27+
$sentinel = new RedisSentinel([
28+
'host' => '127.0.0.1',
29+
'port' => 26379,
30+
'connectTimeout' => 2.5,
31+
]); // 2.5 sec timeout.
32+
$sentinel = new RedisSentinel([
33+
'host' => '127.0.0.1',
34+
'port' => 26379,
35+
'connectTimeout' => 2.5,
36+
'persistent' => 'sentinel',
37+
]); // persistent connection with id 'sentinel'
38+
$sentinel = new RedisSentinel([
39+
'host' => '127.0.0.1',
40+
'port' => 26379,
41+
'connectTimeout' => 2.5,
42+
'persistent' => '',
43+
]); // also persistent connection with id ''
44+
$sentinel = new RedisSentinel([
45+
'host' => '127.0.0.1',
46+
'port' => 26379,
47+
'connectTimeout' => 1,
48+
'persistent' => null,
49+
'retryInterval' => 100,
50+
]); // 1 sec timeout, 100ms delay between reconnection attempts.
51+
$sentinel = new RedisSentinel([
52+
'host' => '127.0.0.1',
53+
'port' => 26379,
54+
'connectTimeout' => 0,
55+
'persistent' => null,
56+
'retryInterval' => 0,
57+
'readTimeout' => 0,
58+
'auth' => 'secret',
59+
]); // connect sentinel with password authentication
3060
~~~
3161

3262
### Usage

0 commit comments

Comments
 (0)
0