Index: includes/module.inc =================================================================== --- includes/module.inc (revision 0) +++ includes/module.inc (working copy) @@ -403,8 +403,29 @@ */ function module_implements($hook, $sort = FALSE, $refresh = FALSE) { static $implementations; + static $cache_exists; + if (!isset($cache_exists)) { + $cache_exists = function_exists('cache_get'); + } + + // Load implementations from cache. + if (!isset($implementations)) { + if ($cache_exists) { + $cache = cache_get('module_implements'); + if ($cache) { + $implementations = $cache->data; + } + else { + $implementations = array(); + } + } + } + if ($refresh) { + if ($cache_exists) { + cache_clear_all('module_implements', 'cache'); + } $implementations = array(); return; } @@ -417,6 +438,10 @@ $implementations[$hook][] = $module; } } + + if ($cache_exists) { + cache_set('module_implements', $implementations); + } } // The explicit cast forces a copy to be made. This is needed because