public function __construct($config = array())
{
isset($config['adapter']) && ($this->_adapter = $config['adapter']);
isset($config['backup']) && ($this->_backup_driver = $config['backup']);
isset($config['key_prefix']) && ($this->key_prefix = $config['key_prefix']);
// If the specified adapter isn't available, check the backup.
if (!$this->is_supported($this->_adapter)) {
if (!$this->is_supported($this->_backup_driver)) {
// Backup isn't supported either. Default to 'Dummy' driver.
log_message('error', 'Cache adapter "' . $this->_adapter . '" and backup "' . $this->_backup_driver . '" are both unavailable. Cache is now using "Dummy" adapter.');
$this->_adapter = 'dummy';
} else {
// Backup is supported. Set it to primary.
log_message('debug', 'Cache adapter "' . $this->_adapter . '" is unavailable. Falling back to "' . $this->_backup_driver . '" backup adapter.');
$this->_adapter = $this->_backup_driver;
}
}
}