Minor performance tweak to PHPTemp and DiscISAM caching

This commit is contained in:
MarkBaker 2014-08-16 11:12:32 +01:00
parent bdb8b50156
commit 125f39c745
2 changed files with 10 additions and 10 deletions

View File

@ -69,11 +69,11 @@ class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage
$this->_currentObject->detach(); $this->_currentObject->detach();
fseek($this->_fileHandle,0,SEEK_END); fseek($this->_fileHandle,0,SEEK_END);
$offset = ftell($this->_fileHandle);
fwrite($this->_fileHandle, serialize($this->_currentObject)); $this->_cellCache[$this->_currentObjectID] = array(
$this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset, 'ptr' => ftell($this->_fileHandle),
'sz' => ftell($this->_fileHandle) - $offset 'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
); );
$this->_currentCellIsDirty = false; $this->_currentCellIsDirty = false;
} }
$this->_currentObjectID = $this->_currentObject = null; $this->_currentObjectID = $this->_currentObject = null;

View File

@ -61,11 +61,11 @@ class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_
$this->_currentObject->detach(); $this->_currentObject->detach();
fseek($this->_fileHandle,0,SEEK_END); fseek($this->_fileHandle,0,SEEK_END);
$offset = ftell($this->_fileHandle);
fwrite($this->_fileHandle, serialize($this->_currentObject)); $this->_cellCache[$this->_currentObjectID] = array(
$this->_cellCache[$this->_currentObjectID] = array('ptr' => $offset, 'ptr' => ftell($this->_fileHandle),
'sz' => ftell($this->_fileHandle) - $offset 'sz' => fwrite($this->_fileHandle, serialize($this->_currentObject))
); );
$this->_currentCellIsDirty = false; $this->_currentCellIsDirty = false;
} }
$this->_currentObjectID = $this->_currentObject = null; $this->_currentObjectID = $this->_currentObject = null;