You are here

public function PHPExcel_CachedObjectStorage_Memcache::copyCellCollection in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memcache.php \PHPExcel_CachedObjectStorage_Memcache::copyCellCollection()

* Clone the cell collection * *

Parameters

PHPExcel_Worksheet $parent The new worksheet: * @return void

Overrides PHPExcel_CachedObjectStorage_CacheBase::copyCellCollection

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memcache.php, line 204

Class

PHPExcel_CachedObjectStorage_Memcache
PHPExcel_CachedObjectStorage_Memcache

Code

public function copyCellCollection(PHPExcel_Worksheet $parent) {
  parent::copyCellCollection($parent);

  //	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 = $this->_memcache
        ->get($this->_cachePrefix . $cellID . '.cache');
      if ($obj === false) {

        //	Entry no longer exists in Memcache, so clear it from the cache array
        parent::deleteCacheData($cellID);
        throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in MemCache');
      }
      if (!$this->_memcache
        ->add($newCachePrefix . $cellID . '.cache', $obj, NULL, $this->_cacheTime)) {
        $this
          ->__destruct();
        throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in MemCache');
      }
    }
  }
  $this->_cachePrefix = $newCachePrefix;
}