From 06f6885b27ceb896fb3e3b2c67d0c055fbf8f751 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Tue, 3 Sep 2013 12:37:57 +0800 Subject: [PATCH] MDL-41558 cache: Improve performance of cache::make() by using isset instead of array_key_exist() --- cache/classes/factory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache/classes/factory.php b/cache/classes/factory.php index e57d6ef077e..476ec0ba55b 100644 --- a/cache/classes/factory.php +++ b/cache/classes/factory.php @@ -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.