Merge pull request #4525 from masterklavi/memcached_instanceof
Use instanceof instead of get_class() in Cache_memcached
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index 56ab5b8..df02ca2 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -116,7 +116,7 @@
isset($cache_server['port']) OR $cache_server['port'] = $defaults['port'];
isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight'];
- if (get_class($this->_memcached) === 'Memcache')
+ if ($this->_memcached instanceof Memcache)
{
// Third parameter is persistance and defaults to TRUE.
$this->_memcached->addServer(
@@ -126,7 +126,7 @@
$cache_server['weight']
);
}
- else
+ elseif ($this->_memcached instanceof Memcached)
{
$this->_memcached->addServer(
$cache_server['hostname'],
@@ -170,11 +170,11 @@
$data = array($data, time(), $ttl);
}
- if (get_class($this->_memcached) === 'Memcached')
+ if ($this->_memcached instanceof Memcached)
{
return $this->_memcached->set($id, $data, $ttl);
}
- elseif (get_class($this->_memcached) === 'Memcache')
+ elseif ($this->_memcached instanceof Memcache)
{
return $this->_memcached->set($id, $data, 0, $ttl);
}