Snippets

Visser Labs Switch to alternate PHPExcel caching methods for large exports

Created by Michael Visser

File functions.php Added

  • Ignore whitespace
  • Hide word diff
+<?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' );
+?>
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.