summaryrefslogtreecommitdiff
path: root/vendor/symfony/cache/Traits/PhpArrayTrait.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/cache/Traits/PhpArrayTrait.php')
-rw-r--r--vendor/symfony/cache/Traits/PhpArrayTrait.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/vendor/symfony/cache/Traits/PhpArrayTrait.php b/vendor/symfony/cache/Traits/PhpArrayTrait.php
index 89dd8100ba..6e7c72ca7d 100644
--- a/vendor/symfony/cache/Traits/PhpArrayTrait.php
+++ b/vendor/symfony/cache/Traits/PhpArrayTrait.php
@@ -30,6 +30,8 @@ trait PhpArrayTrait
private $keys;
private $values;
+ private static $valuesCache = [];
+
/**
* Store an array of cached values.
*
@@ -116,6 +118,7 @@ EOF;
unset($serialized, $value, $dump);
@rename($tmpFile, $this->file);
+ unset(self::$valuesCache[$this->file]);
$this->initialize();
}
@@ -133,6 +136,7 @@ EOF;
$this->keys = $this->values = [];
$cleared = @unlink($this->file) || !file_exists($this->file);
+ unset(self::$valuesCache[$this->file]);
if ($this->pool instanceof AdapterInterface) {
return $this->pool->clear($prefix) && $cleared;
@@ -146,12 +150,15 @@ EOF;
*/
private function initialize()
{
- if (!file_exists($this->file)) {
+ if (isset(self::$valuesCache[$this->file])) {
+ $values = self::$valuesCache[$this->file];
+ } elseif (!file_exists($this->file)) {
$this->keys = $this->values = [];
return;
+ } else {
+ $values = self::$valuesCache[$this->file] = (include $this->file) ?: [[], []];
}
- $values = (include $this->file) ?: [[], []];
if (2 !== \count($values) || !isset($values[0], $values[1])) {
$this->keys = $this->values = [];