@@ -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