]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/stacker/class_BaseStacker.php
Continued:
[core.git] / framework / main / classes / stacker / class_BaseStacker.php
index 853b0b4c3c8e5b31f896163e9311ccbd5fe7d509..b8562ca3d5a25e2e3518cde2bbe300f020c69984 100644 (file)
@@ -39,6 +39,12 @@ abstract class BaseStacker extends BaseFrameworkSystem {
        const EXCEPTION_NO_STACKER_FOUND            = 0x052;
        const EXCEPTION_STACKER_IS_EMPTY            = 0x053;
 
+       /**
+        * Array "caches" configuration entries for saving "expensive" method
+        * invocations
+        */
+       private $cachedMaxStackSizes = [];
+
        /**
         * Protected constructor
         *
@@ -71,8 +77,9 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                        throw new AlreadyInitializedStackerException(array($this, $stackerName, $forceReInit), self::EXCEPTION_STACKER_ALREADY_INITIALIZED);
                }
 
-               // Initialize the given stack
+               // Initialize the given stack and "cache" configuration entry
                $this->initGenericArrayKey('stacks', $stackerName, 'entries', $forceReInit);
+               $this->cachedMaxStackSizes[$stackerName] = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry(sprintf('stacker_%s_max_size', $stackerName));
 
                // Trace message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-STACKER: EXIT!');
@@ -146,7 +153,7 @@ abstract class BaseStacker extends BaseFrameworkSystem {
                }
 
                // So, is the stack full?
-               $isFull = (($this->getStackCount($stackerName)) == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('stacker_' . $stackerName . '_max_size'));
+               $isFull = (($this->getStackCount($stackerName)) == $this->cachedMaxStackSizes[$stackerName]);
 
                // Return result
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-STACKER: isFull=%d - EXIT!', intval($isFull)));