summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache
diff options
context:
space:
mode:
authorMasterklavi <masterklavi@gmail.com>2016-03-12 07:12:58 +0100
committerMasterklavi <masterklavi@gmail.com>2016-03-12 07:12:58 +0100
commitbbfa3ffdb8096e9d20b800ebbc8de672caf98d9e (patch)
tree0e8c41e233083fbe516cfe1a9b458a2f6b1b137e /system/libraries/Cache
parent1c6a3f4356856899f012c6dc1ae81a21c35016e0 (diff)
Added the destructor (disconnect from memcache(d))
Diffstat (limited to 'system/libraries/Cache')
-rw-r--r--system/libraries/Cache/drivers/Cache_memcached.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php
index c44958b97..91ad4d243 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -286,4 +286,25 @@ class CI_Cache_memcached extends CI_Driver {
{
return (extension_loaded('memcached') OR extension_loaded('memcache'));
}
+
+ // ------------------------------------------------------------------------
+
+ /**
+ * Class destructor
+ *
+ * Closes the connection to Memcache(d) if present.
+ *
+ * @return void
+ */
+ public function __destruct()
+ {
+ if ($this->_memcached instanceof Memcache)
+ {
+ $this->_memcached->close();
+ }
+ elseif ($this->_memcached instanceof Memcached)
+ {
+ $this->_memcached->quit();
+ }
+ }
}