44 $this->_currentObject->detach();
46 fseek($this->_fileHandle,0,SEEK_END);
47 $offset = ftell($this->_fileHandle);
48 fwrite($this->_fileHandle, serialize($this->_currentObject));
50 'sz' => ftell($this->_fileHandle) - $offset
52 $this->_currentObjectID = $this->_currentObject = null;
65 if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
69 $this->_currentObjectID = $pCoord;
70 $this->_currentObject = $cell;
84 if ($pCoord === $this->_currentObjectID) {
90 if (!isset($this->_cellCache[$pCoord])) {
96 $this->_currentObjectID = $pCoord;
97 fseek($this->_fileHandle,$this->_cellCache[$pCoord][
'ptr']);
98 $this->_currentObject = unserialize(fread($this->_fileHandle,$this->_cellCache[$pCoord][
'sz']));
100 $this->_currentObject->attach($this->_parent);
115 $newFileHandle = fopen(
'php://temp/maxmemory:'.$this->_memoryCacheSize,
'a+');
117 fseek($this->_fileHandle,0);
118 while (!feof($this->_fileHandle)) {
119 fwrite($newFileHandle,fread($this->_fileHandle, 1024));
121 $this->_fileHandle = $newFileHandle;
126 if(!is_null($this->_currentObject)) {
127 $this->_currentObject->detach();
128 $this->_currentObject = $this->_currentObjectID = null;
130 $this->_cellCache = array();
133 $this->_parent = null;
141 $this->_memoryCacheSize = (isset($arguments[
'memoryCacheSize'])) ? $arguments[
'memoryCacheSize'] :
'1MB';
144 if (is_null($this->_fileHandle)) {
145 $this->_fileHandle = fopen(
'php://temp/maxmemory:'.$this->_memoryCacheSize,
'a+');
151 if (!is_null($this->_fileHandle)) {
152 fclose($this->_fileHandle);
154 $this->_fileHandle = null;