61 if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
62 $this->_currentObject->detach();
64 $obj = serialize($this->_currentObject);
65 if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.
'.cache')) {
66 if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.
'.cache', $obj, $this->_cacheTime)) {
68 throw new PHPExcel_Exception(
'Failed to store cell '.$this->_currentObjectID.
' in WinCache');
71 if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.
'.cache', $obj, $this->_cacheTime)) {
73 throw new PHPExcel_Exception(
'Failed to store cell '.$this->_currentObjectID.
' in WinCache');
76 $this->_currentCellIsDirty =
false;
79 $this->_currentObjectID = $this->_currentObject =
null;
92 if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !==
null)) {
95 $this->_cellCache[$pCoord] =
true;
97 $this->_currentObjectID = $pCoord;
98 $this->_currentObject = $cell;
99 $this->_currentCellIsDirty =
true;
113 if (parent::isDataSet($pCoord)) {
114 if ($this->_currentObjectID == $pCoord) {
118 $success = wincache_ucache_exists($this->_cachePrefix.$pCoord.
'.cache');
121 parent::deleteCacheData($pCoord);
138 if ($pCoord === $this->_currentObjectID) {
145 if (parent::isDataSet($pCoord)) {
147 $obj = wincache_ucache_get($this->_cachePrefix.$pCoord.
'.cache',
$success);
150 parent::deleteCacheData($pCoord);
159 $this->_currentObjectID = $pCoord;
160 $this->_currentObject = unserialize($obj);
162 $this->_currentObject->attach($this);
175 if ($this->_currentObjectID !==
null) {
179 return parent::getCellList();
191 wincache_ucache_delete($this->_cachePrefix.$pCoord.
'.cache');
194 parent::deleteCacheData($pCoord);
205 parent::copyCellCollection($parent);
208 $newCachePrefix = substr(md5($baseUnique),0,8).
'.';
210 foreach($cacheList as $cellID) {
211 if ($cellID != $this->_currentObjectID) {
213 $obj = wincache_ucache_get($this->_cachePrefix.$cellID.
'.cache',
$success);
216 parent::deleteCacheData($cellID);
219 if (!wincache_ucache_add($newCachePrefix.$cellID.
'.cache', $obj, $this->_cacheTime)) {
225 $this->_cachePrefix = $newCachePrefix;
235 if(!is_null($this->_currentObject)) {
236 $this->_currentObject->detach();
237 $this->_currentObject = $this->_currentObjectID =
null;
243 $this->_cellCache = array();
246 $this->_parent =
null;
257 $cacheTime = (isset($arguments[
'cacheTime'])) ? $arguments[
'cacheTime'] : 600;
259 if (is_null($this->_cachePrefix)) {
261 $this->_cachePrefix = substr(md5($baseUnique),0,8).
'.';
262 $this->_cacheTime = $cacheTime;
264 parent::__construct($parent);
274 foreach($cacheList as $cellID) {
275 wincache_ucache_delete($this->_cachePrefix.$cellID.
'.cache');
287 if (!function_exists(
'wincache_ucache_add')) {
An exception for terminatinating execution or to throw for unit testing.
_getUniqueID()
Generate a unique ID for cache referencing.
isDataSet($pCoord)
Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
addCacheData($pCoord, PHPExcel_Cell $cell)
Add or Update a cell in cache identified by coordinate address.
copyCellCollection(PHPExcel_Worksheet $parent)
Clone the cell collection.
getCacheData($pCoord)
Get cell at a specific coordinate.
__construct(PHPExcel_Worksheet $parent, $arguments)
Initialise this new cell collection.
deleteCacheData($pCoord)
Delete a cell in cache identified by coordinate address.
getCellList()
Get a list of all cell addresses currently held in cache.
__destruct()
Destroy this cell collection.
unsetWorksheetCells()
Clear the cell collection and disconnect from our parent.
static cacheMethodIsAvailable()
Identify whether the caching method is currently available Some methods are dependent on the availabi...