Update dependencies

This commit is contained in:
Kode
2022-06-29 13:20:08 +01:00
parent bbae811cd8
commit e2ba89c80e
349 changed files with 21017 additions and 4079 deletions

View File

@@ -81,7 +81,10 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter
// ArrayAdapter works in memory, we don't care about stampede protection
if (\INF === $beta || !$item->isHit()) {
$save = true;
$this->save($item->set($callback($item, $save)));
$item->set($callback($item, $save));
if ($save) {
$this->save($item);
}
}
return $item->get();

View File

@@ -94,9 +94,17 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
*/
public function get(string $key, callable $callback, float $beta = null, array &$metadata = null)
{
$doSave = true;
$callback = static function (CacheItem $item, bool &$save) use ($callback, &$doSave) {
$value = $callback($item, $save);
$doSave = $save;
return $value;
};
$lastItem = null;
$i = 0;
$wrap = function (CacheItem $item = null) use ($key, $callback, $beta, &$wrap, &$i, &$lastItem, &$metadata) {
$wrap = function (CacheItem $item = null, bool &$save = true) use ($key, $callback, $beta, &$wrap, &$i, &$doSave, &$lastItem, &$metadata) {
$adapter = $this->adapters[$i];
if (isset($this->adapters[++$i])) {
$callback = $wrap;
@@ -110,6 +118,7 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa
if (null !== $item) {
(self::$syncItem)($lastItem = $lastItem ?? $item, $item, $this->defaultLifetime, $metadata);
}
$save = $doSave;
return $value;
};