diff options
author | Andrey Andreev <narf@devilix.net> | 2016-03-12 11:13:43 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2016-03-12 11:14:59 +0100 |
commit | 522c3f32c0fe3113ce6ffc7d79c0e698dfc0bcc1 (patch) | |
tree | 71fa1744dfcb7a9c09d480c712d6bf010d596a1c | |
parent | 7243d0b9019eec108255fae5b7eaf08a14a8092e (diff) |
Merge pull request #4522 from masterklavi/memcached_destruct
Added destructor to Cache_memcached
-rw-r--r-- | system/libraries/Cache/drivers/Cache_memcached.php | 21 |
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(); + } + } } |