From: Matthias Schmidt Date: Sun, 27 Mar 2016 15:09:16 +0000 (+0200) Subject: Improve AbstractRuntimeCache implementation X-Git-Tag: 3.0.0_Beta_1~1286^2~15 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2061eb146b87781016404b089beb8f233265ead1;p=GitHub%2FWoltLab%2FWCF.git Improve AbstractRuntimeCache implementation --- 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]); } } }