$config =
$this->config;
$this->redis =
new Redis();
try { // Note:: If Redis is your primary cache choice, and it is "offline", every page load will end up been delayed by the timeout duration.
// I feel like some sort of temporary flag should be set, to indicate that we think Redis is "offline", allowing us to bypass the timeout for a set period of time.
if (!
$this->redis->
connect($config['host'
],
($config['host'
][0
] === '/' ? 0 :
$config['port'
]),
$config['timeout'
])) { // Note:: I'm unsure if log_message() is necessary, however I'm not 100% comfortable removing it.
log_message('error', 'Cache: Redis connection failed. Check your configuration.'
);
throw new CriticalError('Cache: Redis connection failed. Check your configuration.'
);
} if (isset($config['password'
]) && !
$this->redis->
auth($config['password'
])) { log_message('error', 'Cache: Redis authentication failed.'
);
throw new CriticalError('Cache: Redis authentication failed.'
);
} if (isset($config['database'
]) && !
$this->redis->
select($config['database'
])) {