4

I use PhpOffice\PhpSpreadsheet with Apcu caching, and i have this error
Error: Cell entry A1 no longer exists in cache. This probably means that the cache was cleared by someone else.

$pool = new \Cache\Adapter\Apcu\ApcuCachePool();
$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool);

\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache);

$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load(dirname(__FILE__).'/Tmpfile'.$i.'.xlsx');

$objPHPExcel->setActiveSheetIndex(0);

foreach ( $objPHPExcel->getActiveSheet()->getRowIterator() as $row ) {
    if ( $row->getRowIndex() == 1 ){
        $row->getCellIterator();
        $cellIterator = $row->getCellIterator();
        $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set
        $shop_row = array();
        try {
            foreach ($cellIterator as $key => $cell) { // <<<====== WHERE I got the ERROR
                $key = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($key); ....

I haven't any idea to solve this problem.
php version 7.1
phpOffice 1.5.2
5.1.17

Ekhrikhor
  • 91
  • 2
  • 5

1 Answers1

1

The problem is coming from the value of memory allowed for APCu was exceeded php.ini > apcu > please change the value of "apc.shm_size" example:

apc.shm_size=1024M