From 2061eb146b87781016404b089beb8f233265ead1 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 27 Mar 2016 17:09:16 +0200 Subject: [PATCH] Improve AbstractRuntimeCache implementation --- .../system/cache/runtime/AbstractRuntimeCache.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php b/wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php index 5061a706ad..04f2dcd201 100644 --- a/wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php +++ b/wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php @@ -46,8 +46,8 @@ abstract class AbstractRuntimeCache extends SingletonFactory implements IRuntime */ public function cacheObjectIDs(array $objectIDs) { foreach ($objectIDs as $objectID) { - if (!array_key_exists($objectID, $this->objects) && !in_array($objectID, $this->objectIDs)) { - $this->objectIDs[] = $objectID; + if (!array_key_exists($objectID, $this->objects) && !isset($this->objectIDs[$objectID])) { + $this->objectIDs[$objectID] = $objectID; } } } @@ -134,9 +134,7 @@ abstract class AbstractRuntimeCache extends SingletonFactory implements IRuntime */ public function removeObjects(array $objectIDs) { foreach ($objectIDs as $objectID) { - if (array_key_exists($objectID, $this->objects)) { - unset($this->objects[$objectID]); - } + unset($this->objects[$objectID]); } } } -- 2.20.1