You are here

public function PHPExcel_CachedObjectStorage_APC::getCacheData in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/APC.php \PHPExcel_CachedObjectStorage_APC::getCacheData()

Get cell at a specific coordinate

@access public

Parameters

string $pCoord Coordinate of the cell:

Return value

PHPExcel_Cell Cell that was found, or null if not found

Throws

PHPExcel_Exception

Overrides PHPExcel_CachedObjectStorage_ICache::getCacheData

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/APC.php, line 135

Class

PHPExcel_CachedObjectStorage_APC
PHPExcel_CachedObjectStorage_APC

Code

public function getCacheData($pCoord) {
  if ($pCoord === $this->_currentObjectID) {
    return $this->_currentObject;
  }
  $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
      parent::deleteCacheData($pCoord);
      throw new PHPExcel_Exception('Cell entry ' . $pCoord . ' no longer exists in APC cache');
    }
  }
  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 this as the cell's parent
  $this->_currentObject
    ->attach($this);

  //    Return requested entry
  return $this->_currentObject;
}