Commit c2fdf840 authored by robertDouglass's avatar robertDouglass
Browse files

Close network resources when flushing the bin->Memcache mappings.

parent 1e9db3b3
...@@ -89,11 +89,11 @@ function dmemcache_stats($bin = 'cache') { ...@@ -89,11 +89,11 @@ function dmemcache_stats($bin = 'cache') {
* Returns an Memcache object based on the bin requested. Note that there is * Returns an Memcache object based on the bin requested. Note that there is
* nothing preventing developers from calling this function directly to get the * nothing preventing developers from calling this function directly to get the
* Memcache object. Do this if you need functionality not provided by this API * Memcache object. Do this if you need functionality not provided by this API
* or if you need to use existing code. Otherwise, use the dmemcache (get, set, * or if you need to use legacy code. Otherwise, use the dmemcache (get, set,
* delete, flush) API functions provided here. * delete, flush) API functions provided here.
* *
* @param $bin The bin which is to be used. Note that this maps to a physical server that * @param $bin The bin which is to be used.
* may or may not be shared with other bins. *
* @param $flush Rebuild the bin/server/cache mapping. * @param $flush Rebuild the bin/server/cache mapping.
* *
* @return an Memcache object or FALSE. * @return an Memcache object or FALSE.
...@@ -102,6 +102,9 @@ function dmemcache_object($bin = NULL, $flush = FALSE) { ...@@ -102,6 +102,9 @@ function dmemcache_object($bin = NULL, $flush = FALSE) {
static $memcacheCache = array(), $memcache_servers, $memcache_bins; static $memcacheCache = array(), $memcache_servers, $memcache_bins;
if($flush) { if($flush) {
foreach ($memcacheCache as $cluster) {
$cluster->close();
}
$memcacheCache = array(); $memcacheCache = array();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment