Improve AbstractRuntimeCache implementation
authorMatthias Schmidt <gravatronics@live.com>
Sun, 27 Mar 2016 15:09:16 +0000 (17:09 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 27 Mar 2016 15:09:16 +0000 (17:09 +0200)
wcfsetup/install/files/lib/system/cache/runtime/AbstractRuntimeCache.class.php

index 5061a706ad777c62839e380480a1fcd688a47834..04f2dcd2018c478de573b73c7a8d568c2100dd0b 100644 (file)
@@ -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]);
                }
        }
 }