mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
⬆️ N°4770 Update to latest Symfony 3.4
This commit is contained in:
15
lib/symfony/cache/Adapter/ArrayAdapter.php
vendored
15
lib/symfony/cache/Adapter/ArrayAdapter.php
vendored
@@ -25,6 +25,7 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
|
||||
use ArrayTrait;
|
||||
|
||||
private $createCacheItem;
|
||||
private $defaultLifetime;
|
||||
|
||||
/**
|
||||
* @param int $defaultLifetime
|
||||
@@ -32,14 +33,14 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
|
||||
*/
|
||||
public function __construct($defaultLifetime = 0, $storeSerialized = true)
|
||||
{
|
||||
$this->defaultLifetime = $defaultLifetime;
|
||||
$this->storeSerialized = $storeSerialized;
|
||||
$this->createCacheItem = \Closure::bind(
|
||||
static function ($key, $value, $isHit) use ($defaultLifetime) {
|
||||
static function ($key, $value, $isHit) {
|
||||
$item = new CacheItem();
|
||||
$item->key = $key;
|
||||
$item->value = $value;
|
||||
$item->isHit = $isHit;
|
||||
$item->defaultLifetime = $defaultLifetime;
|
||||
|
||||
return $item;
|
||||
},
|
||||
@@ -112,6 +113,10 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
|
||||
$value = $item["\0*\0value"];
|
||||
$expiry = $item["\0*\0expiry"];
|
||||
|
||||
if (0 === $expiry) {
|
||||
$expiry = \PHP_INT_MAX;
|
||||
}
|
||||
|
||||
if (null !== $expiry && $expiry <= time()) {
|
||||
$this->deleteItem($key);
|
||||
|
||||
@@ -127,12 +132,12 @@ class ArrayAdapter implements AdapterInterface, LoggerAwareInterface, Resettable
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (null === $expiry && 0 < $item["\0*\0defaultLifetime"]) {
|
||||
$expiry = time() + $item["\0*\0defaultLifetime"];
|
||||
if (null === $expiry && 0 < $this->defaultLifetime) {
|
||||
$expiry = time() + $this->defaultLifetime;
|
||||
}
|
||||
|
||||
$this->values[$key] = $value;
|
||||
$this->expiries[$key] = null !== $expiry ? $expiry : PHP_INT_MAX;
|
||||
$this->expiries[$key] = null !== $expiry ? $expiry : \PHP_INT_MAX;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user