diff options
author | Tyler Brownell <tyler@bluefoxstudio.ca> | 2015-04-23 21:38:06 +0200 |
---|---|---|
committer | Tyler Brownell <tyler@bluefoxstudio.ca> | 2015-04-23 21:38:06 +0200 |
commit | 229a546efbbc0e6d70c2ea764d74b9c1c57516c2 (patch) | |
tree | 737ad6a525e453098ee7e3276e9b28dc143ec2e4 /system/libraries/Cache/Cache.php | |
parent | 24812132d7aa039bbdca1f150a850dc776ce7bd7 (diff) |
Cache Library Defaults Fixed
- Comments!
- Updates the cache library to validate *both* adapters.
- No longer attempts to set an undefined "memcached" class variable.
- $key variable renamed to $driver_type (more descriptive).
Diffstat (limited to 'system/libraries/Cache/Cache.php')
-rw-r--r-- | system/libraries/Cache/Cache.php | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index fd49f33ab..5d32240ce 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -100,28 +100,19 @@ class CI_Cache extends CI_Driver_Library { */ public function __construct($config = array()) { - $default_config = array( - 'adapter', - 'memcached' - ); - - foreach ($default_config as $key) + // Loop through the available driver types and overwrite them as they're found. + foreach (array('adapter', 'backup') as $driver_type) { - if (isset($config[$key])) + if (isset($config[$driver_type]) && in_array($config[$driver_type], $this->valid_drivers)) { - $param = '_'.$key; - - $this->{$param} = $config[$key]; + $option = '_'.$driver_type; + $this->{$option} = $config[$driver_type]; } } + // Overwrite the default key prefix. isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; - if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers)) - { - $this->_backup = $config['backup']; - } - // If the specified adapter isn't available, check the backup. if ( ! $this->is_supported($this->_adapter)) { |