@@ -18,7 +18,48 @@ 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*
22+
23+ ~~~ php
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
60+ ~~~
61+
62+ ##### * Examples for versions older than 6.0*
2263
2364~~~ php
2465$sentinel = new RedisSentinel('127.0.0.1'); // default parameters
0 commit comments