Snippets

Visser Labs Switch to alternate PHPExcel caching methods for large exports

Created by Michael Visser
<?php
function custom_woo_ce_export_phpexcel_caching_methods() {

	$cacheSettings = array( 'memoryCacheSize '  => '8MB' );

    // Cache to phpTemp
	$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;

    // Cache in memory; gzip
    // $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;

    // Cache in memory; serialized
    // $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized;

    // Cache in memory; discISAM
    // $cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_discISAM;

    PHPExcel_Settings::setCacheStorageMethod( $cacheMethod, $cacheSettings );

}
add_action( 'woo_ce_export_phpexcel_caching_methods', 'custom_woo_ce_export_phpexcel_caching_methods' );
?>

Comments (0)