[Cache] Fixed expiry maybe int due too race conditions
This commit is contained in:
parent
2fb61a4e86
commit
268816f26c
@ -74,7 +74,11 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
|
||||
$item->metadata = $item->newMetadata = $sourceItem->metadata = $sourceMetadata;
|
||||
|
||||
if (isset($item->metadata[CacheItem::METADATA_EXPIRY])) {
|
||||
$item->expiresAt(\DateTime::createFromFormat('U.u', $item->metadata[CacheItem::METADATA_EXPIRY]));
|
||||
if (\is_int($expiry = $item->metadata[CacheItem::METADATA_EXPIRY])) {
|
||||
$item->expiresAt(\DateTime::createFromFormat('U', $expiry));
|
||||
} else {
|
||||
$item->expiresAt(\DateTime::createFromFormat('U.u', sprintf('%.3F', $expiry)));
|
||||
}
|
||||
} elseif (0 < $defaultLifetime) {
|
||||
$item->expiresAfter($defaultLifetime);
|
||||
}
|
||||
|
Reference in New Issue
Block a user