summaryrefslogtreecommitdiff
path: root/vendor/symfony/cache/Adapter/ChainAdapter.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/cache/Adapter/ChainAdapter.php')
-rw-r--r--vendor/symfony/cache/Adapter/ChainAdapter.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/vendor/symfony/cache/Adapter/ChainAdapter.php b/vendor/symfony/cache/Adapter/ChainAdapter.php
index eb1f4404bf..63e97a8d02 100644
--- a/vendor/symfony/cache/Adapter/ChainAdapter.php
+++ b/vendor/symfony/cache/Adapter/ChainAdapter.php
@@ -61,14 +61,15 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
$this->adapterCount = \count($this->adapters);
$this->syncItem = \Closure::bind(
- static function ($sourceItem, $item) use ($defaultLifetime) {
+ static function ($sourceItem, $item, $sourceMetadata = null) use ($defaultLifetime) {
+ $sourceItem->isTaggable = false;
+ $sourceMetadata = $sourceMetadata ?? $sourceItem->metadata;
+ unset($sourceMetadata[CacheItem::METADATA_TAGS]);
+
$item->value = $sourceItem->value;
- $item->expiry = $sourceItem->expiry;
+ $item->expiry = $sourceMetadata[CacheItem::METADATA_EXPIRY] ?? $sourceItem->expiry;
$item->isHit = $sourceItem->isHit;
- $item->metadata = $sourceItem->metadata;
-
- $sourceItem->isTaggable = false;
- unset($sourceItem->metadata[CacheItem::METADATA_TAGS]);
+ $item->metadata = $item->newMetadata = $sourceItem->metadata = $sourceMetadata;
if (0 < $sourceItem->defaultLifetime && $sourceItem->defaultLifetime < $defaultLifetime) {
$defaultLifetime = $sourceItem->defaultLifetime;
@@ -103,7 +104,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
$value = $this->doGet($adapter, $key, $callback, $beta, $metadata);
}
if (null !== $item) {
- ($this->syncItem)($lastItem = $lastItem ?? $item, $item);
+ ($this->syncItem)($lastItem = $lastItem ?? $item, $item, $metadata);
}
return $value;