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
*
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!');
}
// 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)));