diff options
author | John Bellone <jb@thunkbrightly.com> | 2011-08-21 14:54:56 +0200 |
---|---|---|
committer | John Bellone <jb@thunkbrightly.com> | 2011-08-21 14:54:56 +0200 |
commit | 9e8dc0e1b2175fc79b112d469626c76cc13610e3 (patch) | |
tree | 2a24bfcc92c8351c69427f839277e2026237741d /system/libraries/Cache/drivers | |
parent | 43194ea1af658914a89ca49aed4dca4617b9c4ff (diff) |
Making changes to support other Memcached extension
Diffstat (limited to 'system/libraries/Cache/drivers')
-rw-r--r-- | system/libraries/Cache/drivers/Cache_memcached.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index ec2fd216a..405602372 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -153,7 +153,17 @@ class CI_Cache_memcached extends CI_Driver { } } - $this->_memcached = new Memcached(); + if (class_exists('Memcached')) { + $this->_memcached = new Memcached(); + } + else if (class_exists('Memcache')) { + $this->_memcached = new Memcache(); + } + else { + log_message('error', 'Failed to create object for Memcached Cache; extension not loaded?'); + + return FALSE; + } foreach ($this->_memcache_conf as $name => $cache_server) { @@ -189,7 +199,7 @@ class CI_Cache_memcached extends CI_Driver { */ public function is_supported() { - if ( ! extension_loaded('memcached')) + if ( ! extension_loaded('memcached') && ! extension_loaded('memcache')) { log_message('error', 'The Memcached Extension must be loaded to use Memcached Cache.'); |