Refactoring of calculation engine using the multiton pattern to eliminate caching issues when working with multiple workbooks

Refactoring of calculation engine for improved performance and memory usage
Refactoring of cell object to eliminate data duplication and reduce memory
This commit is contained in:
Mark Baker
2013-02-15 15:42:06 +00:00
parent 6fd6b4d044
commit 3886c47ebe
13 changed files with 2702 additions and 2596 deletions
@@ -48,11 +48,15 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
*
* @param string $pCoord Coordinate address of the cell to update
* @param PHPExcel_Cell $cell Cell to update
* @return void
* @return PHPExcel_Cell
* @throws PHPExcel_Exception
*/
public function addCacheData($pCoord, PHPExcel_Cell $cell) {
$this->_cellCache[$pCoord] = $cell;
// Set current entry to the new/updated entry
$this->_currentObjectID = $pCoord;
return $cell;
} // function addCacheData()
@@ -67,10 +71,14 @@ class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_C
public function getCacheData($pCoord) {
// Check if the entry that has been requested actually exists
if (!isset($this->_cellCache[$pCoord])) {
$this->_currentObjectID = NULL;
// Return null if requested entry doesn't exist in cache
return null;
}
// Set current entry to the requested entry
$this->_currentObjectID = $pCoord;
// Return requested entry
return $this->_cellCache[$pCoord];
} // function getCacheData()