MDL-41558 cache: Improve performance of cache::make() by using isset instead of array_key_exist()

This commit is contained in:
Ankit Agarwal
2013-09-03 13:36:59 +08:00
parent ee788142f2
commit 06f6885b27
+2 -2
View File
@@ -173,7 +173,7 @@ class cache_factory {
*/
public function create_cache_from_definition($component, $area, array $identifiers = array(), $aggregate = null) {
$definitionname = $component.'/'.$area;
if (array_key_exists($definitionname, $this->cachesfromdefinitions)) {
if (isset($this->cachesfromdefinitions[$definitionname])) {
$cache = $this->cachesfromdefinitions[$definitionname];
$cache->set_identifiers($identifiers);
return $cache;
@@ -368,7 +368,7 @@ class cache_factory {
if ($aggregate) {
$id .= '::'.$aggregate;
}
if (!array_key_exists($id, $this->definitions)) {
if (!isset($this->definitions[$id])) {
// This is the first time this definition has been requested.
if ($this->is_initialising()) {
// We're initialising the cache right now. Don't try to create another config instance.