ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 isDataSet ($pCoord)
 Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
 getCacheData ($pCoord)
 Get cell at a specific coordinate.
 deleteCacheData ($pCoord)
 Delete a cell in cache identified by coordinate address.
 copyCellCollection (PHPExcel_Worksheet $parent)
 Clone the cell collection.
 unsetWorksheetCells ()
 __construct (PHPExcel_Worksheet $parent, $arguments)
 __destruct ()
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 __construct (PHPExcel_Worksheet $parent)
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache.
 getCellList ()
 Get a list of all cell addresses currently held in cache.
 getSortedCellList ()
 Sort the list of all cell addresses currently held in cache by row and column.
- Public Member Functions inherited from PHPExcel_CachedObjectStorage_ICache
 updateCacheData (PHPExcel_Cell $cell)
 Add or Update a cell in cache.
 getCellList ()
 Get a list of all cell addresses currently held in cache.
 getSortedCellList ()
 Get the list of all cell addresses currently held in cache sorted by column and row.

Private Member Functions

 _storeData ()

Private Attributes

 $_cachePrefix = null
 $_cacheTime = 600

Additional Inherited Members

- Protected Member Functions inherited from PHPExcel_CachedObjectStorage_CacheBase
 _getUniqueID ()
- Protected Attributes inherited from PHPExcel_CachedObjectStorage_CacheBase
 $_parent
 $_currentObject = null
 $_currentObjectID = null
 $_cellCache = array()

Detailed Description

Definition at line 36 of file APC.php.

Constructor & Destructor Documentation

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

Definition at line 198 of file APC.php.

References PHPExcel_CachedObjectStorage_CacheBase\_getUniqueID().

{
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
if (is_null($this->_cachePrefix)) {
$baseUnique = $this->_getUniqueID();
$this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
$this->_cacheTime = $cacheTime;
}
} // function __construct()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_APC::__destruct ( )

Definition at line 211 of file APC.php.

References PHPExcel_CachedObjectStorage_CacheBase\getCellList().

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

{
$cacheList = $this->getCellList();
foreach($cacheList as $cellID) {
apc_delete($this->_cachePrefix.$cellID.'.cache');
}
} // function __destruct()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Function Documentation

PHPExcel_CachedObjectStorage_APC::_storeData ( )
private

Definition at line 43 of file APC.php.

References __destruct().

Referenced by addCacheData(), and getCacheData().

{
$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');
}
$this->_currentObjectID = $this->_currentObject = null;
} // function _storeData()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 62 of file APC.php.

References _storeData().

{
if (($pCoord !== $this->_currentObjectID) && ($this->_currentObjectID !== null)) {
$this->_storeData();
}
$this->_cellCache[$pCoord] = true;
$this->_currentObjectID = $pCoord;
$this->_currentObject = $cell;
return $cell;
} // function addCacheData()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_APC::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

Returns
void

Reimplemented from PHPExcel_CachedObjectStorage_CacheBase.

Definition at line 158 of file APC.php.

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

{
// Get a new id for the new file name
$baseUnique = $this->_getUniqueID();
$newCachePrefix = substr(md5($baseUnique),0,8).'.';
$cacheList = $this->getCellList();
foreach($cacheList as $cellID) {
if ($cellID != $this->_currentObjectID) {
$obj = apc_fetch($this->_cachePrefix.$cellID.'.cache');
if ($obj === false) {
// Entry no longer exists in APC, so clear it from the cache array
throw new Exception('Cell entry '.$cellID.' no longer exists in APC');
}
if (!apc_store($newCachePrefix.$cellID.'.cache',$obj,$this->_cacheTime)) {
$this->__destruct();
throw new Exception('Failed to store cell '.$cellID.' in APC');
}
}
}
$this->_cachePrefix = $newCachePrefix;
} // function copyCellCollection()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_APC::deleteCacheData (   $pCoord)

Delete a cell in cache identified by coordinate address.

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

Reimplemented from PHPExcel_CachedObjectStorage_CacheBase.

Definition at line 144 of file APC.php.

Referenced by copyCellCollection(), getCacheData(), and isDataSet().

{
// Delete the entry from APC
apc_delete($this->_cachePrefix.$pCoord.'.cache');
// Delete the entry from our cell address array
} // function deleteCacheData()

+ Here is the caller graph for this function:

PHPExcel_CachedObjectStorage_APC::getCacheData (   $pCoord)

Get cell at a specific coordinate.

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

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 108 of file APC.php.

References PHPExcel_CachedObjectStorage_CacheBase\$_currentObject, _storeData(), and deleteCacheData().

{
if ($pCoord === $this->_currentObjectID) {
}
$this->_storeData();
// Check if the entry that has been requested actually exists
if (parent::isDataSet($pCoord)) {
$obj = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
if ($obj === false) {
// Entry no longer exists in APC, so clear it from the cache array
throw new Exception('Cell entry '.$cellID.' no longer exists in APC');
}
} else {
// Return null if requested entry doesn't exist in cache
return null;
}
// Set current entry to the requested entry
$this->_currentObjectID = $pCoord;
$this->_currentObject = unserialize($obj);
// Re-attach the parent worksheet
$this->_currentObject->attach($this->_parent);
// Return requested entry
} // function getCacheData()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_APC::isDataSet (   $pCoord)

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

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

Reimplemented from PHPExcel_CachedObjectStorage_CacheBase.

Definition at line 82 of file APC.php.

References deleteCacheData().

{
// 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 apc
$success = apc_fetch($this->_cachePrefix.$pCoord.'.cache');
if ($success === false) {
// Entry no longer exists in APC, so clear it from the cache array
throw new Exception('Cell entry '.$cellID.' no longer exists in APC');
}
return true;
}
return false;
} // function isDataSet()

+ Here is the call graph for this function:

PHPExcel_CachedObjectStorage_APC::unsetWorksheetCells ( )

Definition at line 182 of file APC.php.

References __destruct().

{
if(!is_null($this->_currentObject)) {
$this->_currentObject->detach();
$this->_currentObject = $this->_currentObjectID = null;
}
// Flush the APC cache
$this->__destruct();
$this->_cellCache = array();
// detach ourself from the worksheet, so that it can then delete this object successfully
$this->_parent = null;
} // function unsetWorksheetCells()

+ Here is the call graph for this function:

Field Documentation

PHPExcel_CachedObjectStorage_APC::$_cachePrefix = null
private

Definition at line 38 of file APC.php.

PHPExcel_CachedObjectStorage_APC::$_cacheTime = 600
private

Definition at line 40 of file APC.php.


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