summaryrefslogtreecommitdiffstats
path: root/system/libraries/Cache/drivers/Cache_memcached.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-03-12 11:13:43 +0100
committerAndrey Andreev <narf@devilix.net>2016-03-12 11:14:59 +0100
commit522c3f32c0fe3113ce6ffc7d79c0e698dfc0bcc1 (patch)
tree71fa1744dfcb7a9c09d480c712d6bf010d596a1c /system/libraries/Cache/drivers/Cache_memcached.php
parent7243d0b9019eec108255fae5b7eaf08a14a8092e (diff)
Merge pull request #4522 from masterklavi/memcached_destruct
Added destructor to Cache_memcached
Diffstat (limited to 'system/libraries/Cache/drivers/Cache_memcached.php')
-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 7e67fc40f..8bb4a5696 100644
--- a/system/libraries/Cache/drivers/Cache_memcached.php
+++ b/system/libraries/Cache/drivers/Cache_memcached.php
@@ -287,4 +287,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();
+ }
+ }
}