Basically im trying to enable cell caching due to memory issues (keeps running out) its quite a large speadsheet. From what I have read online cell caching is a good way to go
From the examples I have found online it looks something like this
Cell caching and memory leak
stackoverflow - fix memory error
$oExcel = new PHPExcel();
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
$cacheSettings = array( 'memoryCacheSize' => '512MB');
PHPExcel_Settings::setCacheStorageMethod($cacheMethod,$cacheSettings);
The problem with the above is im not setting the excel object with the settings?
$oExcel->setCacheStorageMethod($cacheMethod,$cacheSettings); // this returns method not found error
I think im just initialising it wrong?
It's described in section 4.2.1 of the developer documentation: the section entitled "Cell Caching"; and you need to set the cell cache before you instantiate or load your PHPExcel object.
setCacheStorageMethod() is not a method of the PHPExcel class, as you're trying to use in this line:
$oExcel->setCacheStorageMethod($cacheMethod,$cacheSettings);
use
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
$cacheSettings = array( 'memoryCacheSize' => '512MB');
PHPExcel_Settings::setCacheStorageMethod($cacheMethod,$cacheSettings);
$oExcel = new PHPExcel();
and the new PHPExcel object will automatically use the configured cache setting (ie phptemp)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With