ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_CachedObjectStorage_Wincache Class Reference
+ Inheritance diagram for PHPExcel_CachedObjectStorage_Wincache:
+ Collaboration diagram for PHPExcel_CachedObjectStorage_Wincache:

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 Wincache.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_CachedObjectStorage_Wincache::__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 256 of file Wincache.php.

References PHPExcel_CachedObjectStorage_CacheBase\_getUniqueID().

256  {
257  $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
258 
259  if (is_null($this->_cachePrefix)) {
260  $baseUnique = $this->_getUniqueID();
261  $this->_cachePrefix = substr(md5($baseUnique),0,8).'.';
262  $this->_cacheTime = $cacheTime;
263 
264  parent::__construct($parent);
265  }
266  } // 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_Wincache::__destruct ( )

Destroy this cell collection.

Definition at line 272 of file Wincache.php.

References getCellList().

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

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

Member Function Documentation

◆ _storeData()

PHPExcel_CachedObjectStorage_Wincache::_storeData ( )
protected

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

Returns
void
Exceptions
PHPExcel_Exception

Definition at line 60 of file Wincache.php.

References __destruct().

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

60  {
61  if ($this->_currentCellIsDirty && !empty($this->_currentObjectID)) {
62  $this->_currentObject->detach();
63 
64  $obj = serialize($this->_currentObject);
65  if (wincache_ucache_exists($this->_cachePrefix.$this->_currentObjectID.'.cache')) {
66  if (!wincache_ucache_set($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
67  $this->__destruct();
68  throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
69  }
70  } else {
71  if (!wincache_ucache_add($this->_cachePrefix.$this->_currentObjectID.'.cache', $obj, $this->_cacheTime)) {
72  $this->__destruct();
73  throw new PHPExcel_Exception('Failed to store cell '.$this->_currentObjectID.' in WinCache');
74  }
75  }
76  $this->_currentCellIsDirty = false;
77  }
78 
79  $this->_currentObjectID = $this->_currentObject = null;
80  } // function _storeData()
__destruct()
Destroy this cell collection.
Definition: Wincache.php:272
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCacheData()

PHPExcel_CachedObjectStorage_Wincache::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
PHPExcel_Cell
Exceptions
PHPExcel_Exception

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 91 of file Wincache.php.

References _storeData().

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

◆ cacheMethodIsAvailable()

static PHPExcel_CachedObjectStorage_Wincache::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 286 of file Wincache.php.

286  {
287  if (!function_exists('wincache_ucache_add')) {
288  return false;
289  }
290 
291  return true;
292  }

◆ copyCellCollection()

PHPExcel_CachedObjectStorage_Wincache::copyCellCollection ( PHPExcel_Worksheet  $parent)

Clone the cell collection.

Parameters
PHPExcel_Worksheet$parentThe new worksheet
Returns
void

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 204 of file Wincache.php.

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

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

◆ deleteCacheData()

PHPExcel_CachedObjectStorage_Wincache::deleteCacheData (   $pCoord)

Delete a cell in cache identified by coordinate address.

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

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 189 of file Wincache.php.

189  {
190  // Delete the entry from Wincache
191  wincache_ucache_delete($this->_cachePrefix.$pCoord.'.cache');
192 
193  // Delete the entry from our cell address array
194  parent::deleteCacheData($pCoord);
195  } // function deleteCacheData()

◆ getCacheData()

PHPExcel_CachedObjectStorage_Wincache::getCacheData (   $pCoord)

Get cell at a specific coordinate.

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 137 of file Wincache.php.

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

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

◆ getCellList()

PHPExcel_CachedObjectStorage_Wincache::getCellList ( )

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

Returns
string[]

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 174 of file Wincache.php.

References _storeData().

Referenced by __destruct(), and copyCellCollection().

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

◆ isDataSet()

PHPExcel_CachedObjectStorage_Wincache::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
boolean

Implements PHPExcel_CachedObjectStorage_ICache.

Definition at line 111 of file Wincache.php.

References $success.

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

◆ unsetWorksheetCells()

PHPExcel_CachedObjectStorage_Wincache::unsetWorksheetCells ( )

Clear the cell collection and disconnect from our parent.

Returns
void

Definition at line 234 of file Wincache.php.

References __destruct(), and array.

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

Field Documentation

◆ $_cachePrefix

PHPExcel_CachedObjectStorage_Wincache::$_cachePrefix = null
private

Definition at line 43 of file Wincache.php.

◆ $_cacheTime

PHPExcel_CachedObjectStorage_Wincache::$_cacheTime = 600
private

Definition at line 50 of file Wincache.php.


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