Store cell data in cache for the current cell object if it's "dirty",
and the 'nullify' the current cell object

@return    void
@throws    PHPExcel_Exception
332588
protected function storeData()
    {
        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
            $this->currentObject->detach();

            fseek($this->fileHandle, 0, SEEK_END);

            $this->cellCache[$this->currentObjectID] = array(
                'ptr' => ftell($this->fileHandle),
                'sz'  => fwrite($this->fileHandle, serialize($this->currentObject))
            );
            $this->currentCellIsDirty = false;
        }
        $this->currentObjectID = $this->currentObject = null;
    }
409667
public function isDataSet($pCoord) {
		if ($pCoord === $this->_currentObjectID) {
			return TRUE;
		}

		//	Check if the requested entry exists in the cache
		$this->_selectQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
		$cellResult = $this->_selectQuery->execute();
		if ($cellResult === FALSE) {
			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
		}
		$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);

		return ($cellData === FALSE) ? FALSE : TRUE;
	}
1354422
public function unsetWorksheetCells() {
		//	Because cells are all stored as intact objects in memory, we need to detach each one from the parent
		foreach($this->_cellCache as $k => &$cell) {
			$cell->detach();
			$this->_cellCache[$k] = null;
		}
		unset($cell);

		$this->_cellCache = array();

		//	detach ourself from the worksheet, so that it can then delete this object successfully
		$this->_parent = null;
	}
1344845
public function copyCellCollection(PHPExcel_Worksheet $parent) {
		parent::copyCellCollection($parent);
		//	Open a new stream for the cell cache data
		$newFileHandle = fopen('php://temp/maxmemory:'.$this->_memoryCacheSize,'a+');
		//	Copy the existing cell cache data to the new stream
		fseek($this->_fileHandle,0);
		while (!feof($this->_fileHandle)) {
			fwrite($newFileHandle,fread($this->_fileHandle, 1024));
		}
		$this->_fileHandle = $newFileHandle;
	}
1286369
function _memoryCacheAdd($data)
    {
        $this->_touchCacheFile();
        $this->_memoryCachingArray[$this->_file] = $data;
        if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
            $key = key($this->_memoryCachingArray);
            next($this->_memoryCachingArray);
            unset($this->_memoryCachingArray[$key]);
            
        } else {
            $this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
        }
    }
519483
private function _populate_cache()
    {
        if ($this->_use_json) {
            if (is_readable($this->_cache_file) &&
            ($loaded = @json_decode(Common::getContents($this->_cache_file, ''), true)) && is_array($loaded)) {
                $this->_existing_cache_vals = $loaded;
            }
        } else {
            if (is_readable($this->_cache_file) &&
            ($loaded = @unserialize(Common::getContents($this->_cache_file, false))) && is_array($loaded)) {
                $this->_existing_cache_vals = $loaded;
            }
        }
    }
787758
public function afterSave()
    {
        Cache::forget(implode('-', [$this->table, $this->namespace, $this->group, $this->item]));
    }
1198178
public function prev()
    {
        if ($this->position <= $this->startRow) {
            throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
        }

        do {
            --$this->position;
        } while (($this->onlyExistingCells) &&
            (!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->position)) &&
            ($this->position >= $this->startRow));
    }
117520
public function getCellList()
    {
        if ($this->currentObjectID !== null) {
            $this->storeData();
        }

        $query = "SELECT id FROM kvp_".$this->TableName;
        $cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
        if ($cellIdsResult === false) {
            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
        }

        $cellKeys = array();
        foreach ($cellIdsResult as $row) {
            $cellKeys[] = $row['id'];
        }

        return $cellKeys;
    }
232769
protected function _storeData() {
		if ($this->_currentCellIsDirty) {
			$this->_currentObject->detach();

			$this->_insertQuery->bindValue('id',$this->_currentObjectID,SQLITE3_TEXT);
			$this->_insertQuery->bindValue('data',serialize($this->_currentObject),SQLITE3_BLOB);
			$result = $this->_insertQuery->execute();
			if ($result === false)
				throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());
			$this->_currentCellIsDirty = false;
		}
		$this->_currentObjectID = $this->_currentObject = null;
	}
780130
public function isDataSet($pCoord) {
		//	Check if the requested entry is the current object, or exists in the cache
		if (parent::isDataSet($pCoord)) {
			if ($this->_currentObjectID == $pCoord) {
				return true;
			}
			//	Check if the requested entry still exists in cache
			$success = wincache_ucache_exists($this->_cachePrefix.$pCoord.'.cache');
			if ($success === false) {
				//	Entry no longer exists in Wincache, so clear it from the cache array
				parent::deleteCacheData($pCoord);
				throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
			}
			return true;
		}
		return false;
	}
1211239
public function hasHyperlink()
	{
		if (!isset($this->_parent)) {
			throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
		}

		return $this->getWorksheet()->hyperlinkExists($this->getCoordinate());
	}
1166919
public function persist($data = null)
    {
        if (is_null($data)) {
            $data = $this->database->toArray();
        }

        if (! is_array($data)) {
            $data = $data->toArray();
        }

        $this->makeDir($this->getFileName());

        file_put_contents($this->getFileName(), json_encode($data));
    }
997714
public function prev()
    {
        if ($this->position <= $this->startColumn) {
            throw new PHPExcel_Exception(
                "Column is already at the beginning of range (" .
                PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " .
                PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")"
            );
        }

        --$this->position;
    }
1331397
public function copyCellCollection(PHPExcel_Worksheet $parent) {
		$this->_currentCellIsDirty;
        $this->_storeData();

		//	Get a new id for the new table name
		$tableName = str_replace('.','_',$this->_getUniqueID());
		if (!$this->_DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
		                                       AS SELECT * FROM kvp_'.$this->_TableName))
			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());

		//	Copy the existing cell cache file
		$this->_TableName = $tableName;
	}
827922
public function save()
    {
        $contents = $this->getForStorage();

        if (!is_null($this->expire)) {
            $this->cache->set($this->key, $contents, $this->expire);
        } else {
            $this->cache->set($this->key, $contents);
        }
    }
1320694
public function deleteCacheData($pCoord) {
		if ($pCoord === $this->_currentObjectID) {
			$this->_currentObject->detach();
			$this->_currentObjectID = $this->_currentObject = NULL;
		}

		//	Check if the requested entry exists in the cache
		$this->_deleteQuery->bindValue('id',$pCoord,SQLITE3_TEXT);
		$result = $this->_deleteQuery->execute();
		if ($result === FALSE)
			throw new PHPExcel_Exception($this->_DBHandle->lastErrorMsg());

		$this->_currentCellIsDirty = FALSE;
	}