Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ad95b6

Browse files
authored
Add back old examples with note
1 parent 849bedb commit 1ad95b6

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

sentinel.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Redis Sentinel also provides other collateral tasks such as monitoring, notifica
1818
*read_timeout*: Float, value in seconds (optional, default is 0 meaning unlimited)
1919
*auth*:String, or an Array with one or two elements, used to authenticate with the redis-sentinel. (optional, default is NULL meaning NOAUTH)
2020

21-
##### *Example*
21+
##### *Examples for version 6.0 or later*
2222

2323
~~~php
2424
$sentinel = new RedisSentinel([
@@ -59,6 +59,17 @@ $sentinel = new RedisSentinel([
5959
]); // connect sentinel with password authentication
6060
~~~
6161

62+
##### *Examples for versions older than 6.0*
63+
64+
~~~php
65+
$sentinel = new RedisSentinel('127.0.0.1'); // default parameters
66+
$sentinel = new RedisSentinel('127.0.0.1', 26379, 2.5); // 2.5 sec timeout.
67+
$sentinel = new RedisSentinel('127.0.0.1', 26379, 0, 'sentinel'); // persistent connection with id 'sentinel'
68+
$sentinel = new RedisSentinel('127.0.0.1', 26379, 0, ''); // also persistent connection with id ''
69+
$sentinel = new RedisSentinel('127.0.0.1', 26379, 1, null, 100); // 1 sec timeout, 100ms delay between reconnection attempts.
70+
$sentinel = new RedisSentinel('127.0.0.1', 26379, 0, NULL, 0, 0, "secret"); // connect sentinel with password authentication
71+
~~~
72+
6273
### Usage
6374
-----
6475

0 commit comments

Comments
 (0)