Reduce size of Unique ID Prefix used for the Cell Collection when "in memory" (reduces the per-cell memory overhead, while still retaining a unique prefix to ensure no clash between worksheet collections).
External cache (where multiple threads may be accessing the same cache with different workeets) still uses the same length and entropy in the prefix as before
This commit is contained in:
parent
9275d0c59e
commit
ad56616309
|
|
@ -6,6 +6,7 @@ use Generator;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
use PhpOffice\PhpSpreadsheet\Cell\Cell;
|
||||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
|
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Settings;
|
||||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
use Psr\SimpleCache\CacheInterface;
|
use Psr\SimpleCache\CacheInterface;
|
||||||
|
|
||||||
|
|
@ -298,7 +299,9 @@ class Cells
|
||||||
*/
|
*/
|
||||||
private function getUniqueID()
|
private function getUniqueID()
|
||||||
{
|
{
|
||||||
return uniqid('phpspreadsheet.', true) . '.';
|
return Settings::getCache() instanceof Memory
|
||||||
|
? random_bytes(7) . ':'
|
||||||
|
: uniqid('phpspreadsheet.', true) . '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue