protected function isInMemoryStrategyUsageSafe($sharedStringsUniqueCount)
    {
        // if the number of shared strings in unknown, do not use "in memory" strategy
        if ($sharedStringsUniqueCount === null) {
            return false;
        }

        $memoryAvailable = $this->getMemoryLimitInKB();

        if ($memoryAvailable === -1) {
            // if cannot get memory limit or if memory limit set as unlimited, don't trust and play safe
            return ($sharedStringsUniqueCount < self::MAX_NUM_STRINGS_PER_TEMP_FILE);
        } else {
            $memoryNeeded = $sharedStringsUniqueCount * self::AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB;
            return ($memoryAvailable > $memoryNeeded);
        }
    }
protected function isInMemoryStrategyUsageSafe($sharedStringsUniqueCount)
    {
        // if the number of shared strings in unknown, do not use "in memory" strategy
        if ($sharedStringsUniqueCount === null) {
            return false;
        }

        $memoryAvailable = $this->getMemoryLimitInKB();

        if ($memoryAvailable === -1) {
            // if cannot get memory limit or if memory limit set as unlimited, don't trust and play safe
            return ($sharedStringsUniqueCount < self::MAX_NUM_STRINGS_PER_TEMP_FILE);
        } else {
            $memoryNeeded = $sharedStringsUniqueCount * self::AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB;
            return ($memoryAvailable > $memoryNeeded);
        }
    }
protected function isInMemoryStrategyUsageSafe ( $ sharedStringsUniqueCount ) { // if the number of shared strings in unknown, do not use "in memory" strategy if ( $ sharedStringsUniqueCount === null ) { return false ; } $ memoryAvailable = $ this -> getMemoryLimitInKB ( ) ; if ( $ memoryAvailable === - 1 ) { // if cannot get memory limit or if memory limit set as unlimited, don't trust and play safe return ( $ sharedStringsUniqueCount < self :: MAX_NUM_STRINGS_PER_TEMP_FILE ) ; } else { $ memoryNeeded = $ sharedStringsUniqueCount * self :: AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB ; return ( $ memoryAvailable > $ memoryNeeded ) ; } }
Returns whether it is safe to use in-memory caching, given the number of unique shared strings
and the amount of memory available.

@param int|null $sharedStringsUniqueCount Number of unique shared strings (NULL if unknown)
@return bool
Returns whether it is safe to use in - memory caching given the number of unique shared strings and the amount of memory available .