Use a generator for Cells::getAllCacheKeys
Using a generator reduces memory usage and improves performance when loading large spreadsheets. Closes #822
This commit is contained in:
parent
8918888e7c
commit
f28289f92a
|
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
- Fix VLOOKUP with exact matches - [#809](https://github.com/PHPOffice/PhpSpreadsheet/pull/809)
|
||||
- Support COUNTIFS multiple arguments - [#830](https://github.com/PHPOffice/PhpSpreadsheet/pull/830)
|
||||
- Change `libxml_disable_entity_loader()` as shortly as possible - [#819](https://github.com/PHPOffice/PhpSpreadsheet/pull/819)
|
||||
- Improved memory usage and performance when loading large spreadsheets - [#822](https://github.com/PHPOffice/PhpSpreadsheet/pull/822)
|
||||
|
||||
## [1.5.2] - 2018-11-25
|
||||
|
||||
|
|
|
@ -495,15 +495,12 @@ class Cells
|
|||
/**
|
||||
* Returns all known cache keys.
|
||||
*
|
||||
* @return string[]
|
||||
* @return \Generator|string[]
|
||||
*/
|
||||
private function getAllCacheKeys()
|
||||
{
|
||||
$keys = [];
|
||||
foreach ($this->getCoordinates() as $coordinate) {
|
||||
$keys[] = $this->cachePrefix . $coordinate;
|
||||
yield $this->cachePrefix . $coordinate;
|
||||
}
|
||||
|
||||
return $keys;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue