ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_CachedObjectStorage_APC Class Reference
+ Inheritance diagram for PHPExcel_CachedObjectStorage_APC:
+ Collaboration diagram for PHPExcel_CachedObjectStorage_APC:

Public Member Functions

 addCacheData ($pCoord, PHPExcel_Cell $cell)
 Add or Update a cell in cache identified by coordinate address. More...
 
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? More...
 
 getCacheData ($pCoord)
 Get cell at a specific coordinate. More...
 
 getCellList ()
 Get a list of all cell addresses currently held in cache. More...
 
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address. More...
 
 copyCellCollection (PHPExcel_Worksheet $parent)
 Clone the cell collection. More...
 
 unsetWorksheetCells ()
 Clear the cell collection and disconnect from our parent. More...
 
 __construct (PHPExcel_Worksheet $parent, $arguments)
 Initialise this new cell collection. More...
 
 __destruct ()
 Destroy this cell collection. More...
 
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 __construct (PHPExcel_Worksheet $parent)
 Initialise this new cell collection. More...
 
 getParent ()
 Return the parent worksheet for this cell collection. More...
 
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell? More...
 
 moveCell ($fromAddress, $toAddress)
 Move a cell object from one address to another. More...
 
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache. More...
 
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address. More...
 
 getCellList ()
 Get a list of all cell addresses currently held in cache. More...
 
 getSortedCellList ()
 Sort the list of all cell addresses currently held in cache by row and column. More...
 
 getHighestRowAndColumn ()
 Get highest worksheet column and highest row that have cell records. More...
 
 getCurrentAddress ()
 Return the cell address of the currently active cell object. More...
 
 getCurrentColumn ()
 Return the column address of the currently active cell object. More...
 
 getCurrentRow ()
 Return the row address of the currently active cell object. More...
 
 getHighestColumn ($row=null)
 Get highest worksheet column. More...
 
 getHighestRow ($column=null)
 Get highest worksheet row. More...
 
 copyCellCollection (PHPExcel_Worksheet $parent)
 Clone the cell collection. More...
 
 removeRow ($row)
 Remove a row, deleting all cells in that row. More...
 
 removeColumn ($column)
 Remove a column, deleting all cells in that column. More...
 
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_ICache
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache. More...
 
 getSortedCellList ()
 Get the list of all cell addresses currently held in cache sorted by column and row. More...
 

Static Public Member Functions

static cacheMethodIsAvailable ()
 Identify whether the caching method is currently available Some methods are dependent on the availability of certain extensions being enabled in the PHP build. More...
 
- Static Public Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
static cacheMethodIsAvailable ()
 Identify whether the caching method is currently available Some methods are dependent on the availability of certain extensions being enabled in the PHP build. More...
 

Protected Member Functions

 _storeData ()
 Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current cell object. More...
 
- Protected Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 _getUniqueID ()
 Generate a unique ID for cache referencing. More...
 

Private Attributes

 $_cachePrefix = null
 
 $_cacheTime = 600
 

Additional Inherited Members

- Protected Attributes inherited from PHPExcel_CachedObjectStorage_CacheBase
 $_parent
 
 $_currentObject = null
 
 $_currentObjectID = null
 
 $_currentCellIsDirty = true
 
 $_cellCache = array()
 

Detailed Description

Definition at line 36 of file APC.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_CachedObjectStorage_APC::__construct ( PHPExcel_Worksheet  $parent,
  $arguments 
)

Initialise this new cell collection.

Parameters
PHPExcel_Worksheet$parentThe worksheet for this cell collection
arrayof mixed $arguments Additional initialisation arguments

Definition at line 254 of file APC.php.

References PHPExcel_CachedObjectStorage_CacheBase\_getUniqueID().

254  {
255  $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
256 
257  if ($this->_cachePrefix === NULL) {
258  $baseUnique = $this->_getUniqueID();
259  $this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
260  $this->_cacheTime = $cacheTime;
261 
262  parent::__construct($parent);
263  }
264  } // function __construct()
_getUniqueID()
Generate a unique ID for cache referencing.
Definition: CacheBase.php:311
+ Here is the call graph for this function:

◆ __destruct()

PHPExcel_CachedObjectStorage_APC::__destruct ( )

Destroy this cell collection.

Definition at line 270 of file APC.php.

References getCellList().

Referenced by _storeData(), copyCellCollection(), and unsetWorksheetCells().

270  {
271  $cacheList = $this->getCellList();
272  foreach($cacheList as $cellID) {
273  apc_delete($this->_cachePrefix.$cellID.'.cache');
274  }
275  } // function __destruct()
getCellList()
Get a list of all cell addresses currently held in cache.
Definition: APC.php:170
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ _storeData()

PHPExcel_CachedObjectStorage_APC::_storeData ( )
protected

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

private

Returns
void
Exceptions
PHPExcel_Exception

Definition at line 63 of file APC.php.

References __destruct().

Referenced by addCacheData(), getCacheData(), and getCellList().

63  {
64  if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
65  $this->_currentObject->detach();
66 
67  if (!apc_store($this->_cachePrefix.$this->_currentObjectID.'.cache',serialize($this->_currentObject),$this->_cacheTime)) {
68  $this->__destruct();
69  throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in APC');
70  }
71  $this->_currentCellIsDirty = false;
72  }
73  $this->_currentObjectID = $this->_currentObject = null;
74  } // function _storeData()
__destruct()
Destroy this cell collection.
Definition: APC.php:270
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCacheData()

PHPExcel_CachedObjectStorage_APC::addCacheData (   $pCoord,
PHPExcel_Cell  $cell 
)

Add or Update a cell in cache identified by coordinate address.

public

Parameters
string$pCoordCoordinate address of the cell to update
PHPExcel_Cell$cellCell to update
Returns
PHPExcel_Cell
Exceptions
PHPExcel_Exception

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 86 of file APC.php.

References _storeData().

86  {
87  if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
88  $this->_storeData();
89  }
90  $this->_cellCache[$pCoord] = true;
91 
92  $this->_currentObjectID = $pCoord;
93  $this->_currentObject = $cell;
94  $this->_currentCellIsDirty = true;
95 
96  return $cell;
97  } // function addCacheData()
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: APC.php:63
+ Here is the call graph for this function:

◆ cacheMethodIsAvailable()

static PHPExcel_CachedObjectStorage_APC::cacheMethodIsAvailable ( )
static

Identify whether the caching method is currently available Some methods are dependent on the availability of certain extensions being enabled in the PHP build.

Returns
boolean

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 284 of file APC.php.

284  {
285  if (!function_exists('apc_store')) {
286  return FALSE;
287  }
288  if (apc_sma_info() === FALSE) {
289  return FALSE;
290  }
291 
292  return TRUE;
293  }

◆ copyCellCollection()

PHPExcel_CachedObjectStorage_APC::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

public

Parameters
PHPExcel_Worksheet$parentThe new worksheet
Exceptions
PHPExcel_Exception
Returns
void

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 203 of file APC.php.

References __destruct(), PHPExcel_CachedObjectStorage_CacheBase\_getUniqueID(), and getCellList().

203  {
204  parent::copyCellCollection($parent);
205  // Get a new id for the new file name
206  $baseUnique = $this->_getUniqueID();
207  $newCachePrefix = substr(md5($baseUnique),0,8).'.';
208  $cacheList = $this->getCellList();
209  foreach($cacheList as $cellID) {
210  if ($cellID != $this->_currentObjectID) {
211  $obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
212  if ($obj === FALSE) {
213  // Entry no longer exists in APC, so clear it from the cache array
214  parent::deleteCacheData($cellID);
215  throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in APC');
216  }
217  if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
218  $this->__destruct();
219  throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in APC');
220  }
221  }
222  }
223  $this->_cachePrefix = $newCachePrefix;
224  } // function copyCellCollection()
getCellList()
Get a list of all cell addresses currently held in cache.
Definition: APC.php:170
__destruct()
Destroy this cell collection.
Definition: APC.php:270
_getUniqueID()
Generate a unique ID for cache referencing.
Definition: CacheBase.php:311
+ Here is the call graph for this function:

◆ deleteCacheData()

PHPExcel_CachedObjectStorage_APC::deleteCacheData (   $pCoord)

Delete a cell in cache identified by coordinate address.

public

Parameters
string$pCoordCoordinate address of the cell to delete
Exceptions
PHPExcel_Exception

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 186 of file APC.php.

186  {
187  // Delete the entry from APC
188  apc_delete($this->_cachePrefix.$pCoord.'.cache');
189 
190  // Delete the entry from our cell address array
191  parent::deleteCacheData($pCoord);
192  } // function deleteCacheData()

◆ getCacheData()

PHPExcel_CachedObjectStorage_APC::getCacheData (   $pCoord)

Get cell at a specific coordinate.

public

Parameters
string$pCoordCoordinate of the cell
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Cell Cell that was found, or null if not found

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 135 of file APC.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObject, and _storeData().

135  {
136  if ($pCoord === $this->_currentObjectID) {
137  return $this->_currentObject;
138  }
139  $this->_storeData();
140 
141  // Check if the entry that has been requested actually exists
142  if (parent::isDataSet($pCoord)) {
143  $obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
144  if ($obj === FALSE) {
145  // Entry no longer exists in APC, so clear it from the cache array
146  parent::deleteCacheData($pCoord);
147  throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
148  }
149  } else {
150  // Return null if requested entry doesn't exist in cache
151  return null;
152  }
153 
154  // Set current entry to the requested entry
155  $this->_currentObjectID = $pCoord;
156  $this->_currentObject = unserialize($obj);
157  // Re-attach this as the cell's parent
158  $this->_currentObject->attach($this);
159 
160  // Return requested entry
161  return $this->_currentObject;
162  } // function getCacheData()
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: APC.php:63
+ Here is the call graph for this function:

◆ getCellList()

PHPExcel_CachedObjectStorage_APC::getCellList ( )

Get a list of all cell addresses currently held in cache.

Returns
string[]

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 170 of file APC.php.

References _storeData().

Referenced by __destruct(), and copyCellCollection().

170  {
171  if ($this->_currentObjectID !== null) {
172  $this->_storeData();
173  }
174 
175  return parent::getCellList();
176  }
_storeData()
Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current c...
Definition: APC.php:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isDataSet()

PHPExcel_CachedObjectStorage_APC::isDataSet (   $pCoord)

Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?

public

Parameters
string$pCoordCoordinate address of the cell to check
Exceptions
PHPExcel_Exception
Returns
boolean

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 108 of file APC.php.

References $success.

108  {
109  // Check if the requested entry is the current object, or exists in the cache
110  if (parent::isDataSet($pCoord)) {
111  if ($this->_currentObjectID == $pCoord) {
112  return true;
113  }
114  // Check if the requested entry still exists in apc
115  $success = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
116  if ($success === FALSE) {
117  // Entry no longer exists in APC, so clear it from the cache array
118  parent::deleteCacheData($pCoord);
119  throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
120  }
121  return true;
122  }
123  return false;
124  } // function isDataSet()
$success
Definition: Utf8Test.php:86

◆ unsetWorksheetCells()

PHPExcel_CachedObjectStorage_APC::unsetWorksheetCells ( )

Clear the cell collection and disconnect from our parent.

Returns
void

Definition at line 232 of file APC.php.

References __destruct(), and array.

232  {
233  if ($this->_currentObject !== NULL) {
234  $this->_currentObject->detach();
235  $this->_currentObject = $this->_currentObjectID = null;
236  }
237 
238  // Flush the APC cache
239  $this->__destruct();
240 
241  $this->_cellCache = array();
242 
243  // detach ourself from the worksheet, so that it can then delete this object successfully
244  $this->_parent = null;
245  } // function unsetWorksheetCells()
__destruct()
Destroy this cell collection.
Definition: APC.php:270
Create styles array
The data for the language used.
+ Here is the call graph for this function:

Field Documentation

◆ $_cachePrefix

PHPExcel_CachedObjectStorage_APC::$_cachePrefix = null
private

Definition at line 44 of file APC.php.

◆ $_cacheTime

PHPExcel_CachedObjectStorage_APC::$_cacheTime = 600
private

Definition at line 52 of file APC.php.


The documentation for this class was generated from the following file: