Problems using the PHPExcel cache system with Laravel 4.2

0

I am trying to use the PHPExcel library cache system , however I am still getting memory overflow in my application. I need to use cache because I am generating reports with more than 100,000 records on a server with limited memory. Therefore, increasing memory usage in the php.ini file would not solve my problem. I use the following code in the class constructor:

public function __construct() {
        $templateFileName = $this->getTemplateFileName();
        $fullPathTemplate = public_path().'/Temp/'.$templateFileName.'.xlsx';

        $cacheMethod = \PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
        $cacheSettings = array(
            'memoryCacheSize' => '50MB'
        );
        if (! \PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings)) {
            die($cacheMethod . " Cache invalido " . EOL);
        }
        \Log::info("Utilizando PHPExcel com sistema de cache.");



        $objPhpReader = new \PHPExcel_Reader_Excel2007();
        $this->phpExcelObject = $objPhpReader->load($fullPathTemplate);
}

I have the impression that it is not enabling the caching system, the error returned in the Laravel 4.2 4.2 log is as follows:

[2016-12-06 15:38:42] production.INFO: Utilizando PHPExcel com sistema de cache. [] []
[2016-12-06 15:45:29] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Out of memory (allocated 1857028096) (tried to allocate 8388608 bytes)' in D:\Projetos\Rel\vendor\phpoffice\phpexcel\Classes\PHPExcel\CachedObjectStorage\PHPTemp.php:65
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []

Thank you in advance for your attention.

    
asked by anonymous 06.12.2016 / 19:27

0 answers