Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RedisConnectionValidator.php
Go to the documentation of this file.
1 <?php
8 
13 {
20  public function isValidConnection(array $redisOptions)
21  {
22  $default = [
23  'host' => '',
24  'port' => '',
25  'db' => '',
26  'password' => null,
27  'timeout' => null,
28  'persistent' => ''
29  ];
30 
31  $config = array_merge($default, $redisOptions);
32 
33  try {
34  $redisClient = new \Credis_Client(
35  $config['host'],
36  $config['port'],
37  $config['timeout'],
38  $config['persistent'],
39  $config['db'],
40  $config['password']
41  );
42  $redisClient->setMaxConnectRetries(1);
43  $redisClient->connect();
44  } catch (\CredisException $e) {
45  return false;
46  }
47 
48  return true;
49  }
50 }
$config
Definition: fraud_order.php:17