1 | <?php |
||
30 | class RedisSentinelDatabase extends RedisDatabase |
||
31 | { |
||
32 | /** |
||
33 | * Configuration options specific to Sentinel connection operation |
||
34 | * |
||
35 | * We cannot pass these options as an array to the Predis client. |
||
36 | * Instead, we'll set them on the connection directly using methods |
||
37 | * provided by the SentinelReplication class of the Predis package. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $sentinelConnectionOptionKeys = [ |
||
42 | 'sentinel_timeout', |
||
43 | 'retry_wait', |
||
44 | 'retry_limit', |
||
45 | 'update_sentinels', |
||
46 | ]; |
||
47 | |||
48 | /** |
||
49 | * Subscribe to a set of given channels for messages. |
||
50 | * |
||
51 | * @param array|string $channels The names of the channels to subscribe to |
||
52 | * @param Closure $callback Executed for each message. Receives the |
||
53 | * message string in the first argument and the message channel as the |
||
54 | * second argument. Return FALSE to unsubscribe. |
||
55 | * @param string|null $connection Name of the connection to subscribe with. |
||
56 | * @param string $method The subscription command ("subscribe" or |
||
57 | * "psubscribe"). |
||
58 | * |
||
59 | * @return void |
||
60 | */ |
||
61 | public function subscribe( |
||
70 | |||
71 | /** |
||
72 | * Subscribe to a set of given channels with wildcards. |
||
73 | * |
||
74 | * @param array|string $channels The names of the channels to subscribe to |
||
75 | * @param Closure $callback Executed for each message. Receives the |
||
76 | * message string in the first argument and the message channel as the |
||
77 | * second argument. Return FALSE to unsubscribe. |
||
78 | * @param string|null $connection Name of the connection to subscribe with. |
||
79 | * |
||
80 | * @return void |
||
81 | */ |
||
82 | public function psubscribe($channels, Closure $callback, $connection = null) |
||
86 | |||
87 | /** |
||
88 | * Create an array of single connection clients. |
||
89 | * |
||
90 | * @param array $servers The set of options for each Sentinel connection |
||
91 | * @param array $options The global options shared by all Sentinel clients |
||
92 | * |
||
93 | * @return array Each element contains a Predis client that represents a |
||
94 | * connection defined in the 'redis-sentinel' block in config/database.php |
||
95 | */ |
||
96 | protected function createSingleClients(array $servers, array $options = []) |
||
116 | |||
117 | /** |
||
118 | * Create a Predis client instance for a Redis Sentinel connection |
||
119 | * |
||
120 | * @param array $server The configuration options for the connection |
||
121 | * @param array $options The global options shared by all Sentinel clients |
||
122 | * |
||
123 | * @return Client The Predis Client instance |
||
|
|||
124 | */ |
||
125 | protected function createSingleClient(array $server, array $options) |
||
147 | |||
148 | /** |
||
149 | * Sets the Sentinel-specific connection options on a Predis Client |
||
150 | * connection |
||
151 | * |
||
152 | * @param Client $client The Predis Client to set options for |
||
153 | * @param array $sentinelOpts The options supported by Predis for |
||
154 | * Sentinel-specific connections |
||
155 | * |
||
156 | * @return void |
||
157 | */ |
||
158 | protected function setSentinelConnectionOptions( |
||
168 | } |
||
169 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.