General: Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@72227 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker
2011-04-25 14:25:53 +00:00
parent ff4daef39c
commit 5672f25ebf
9 changed files with 76 additions and 39 deletions
+8 -4
View File
@@ -41,11 +41,14 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
private function _storeData() {
$this->_currentObject->detach();
if ($this->_currentCellIsDirty) {
$this->_currentObject->detach();
if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
$this->__destruct();
throw new Exception('Failed to store cell '.$cellID.' in APC');
if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
$this->__destruct();
throw new Exception('Failed to store cell '.$cellID.' in APC');
}
$this->_currentCellIsDirty = false;
}
$this->_currentObjectID = $this->_currentObject = null;
} // function _storeData()
@@ -67,6 +70,7 @@ class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_Cach
$this->_currentObjectID = $pCoord;
$this->_currentObject = $cell;
$this->_currentCellIsDirty = true;
return $cell;
} // function addCacheData()