summaryrefslogtreecommitdiff
path: root/vendor/symfony/cache/Simple
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/cache/Simple')
-rw-r--r--vendor/symfony/cache/Simple/AbstractCache.php19
-rw-r--r--vendor/symfony/cache/Simple/ApcuCache.php5
-rw-r--r--vendor/symfony/cache/Simple/ArrayCache.php10
-rw-r--r--vendor/symfony/cache/Simple/ChainCache.php18
-rw-r--r--vendor/symfony/cache/Simple/DoctrineCache.php7
-rw-r--r--vendor/symfony/cache/Simple/FilesystemCache.php7
-rw-r--r--vendor/symfony/cache/Simple/MemcachedCache.php7
-rw-r--r--vendor/symfony/cache/Simple/NullCache.php10
-rw-r--r--vendor/symfony/cache/Simple/PdoCache.php7
-rw-r--r--vendor/symfony/cache/Simple/PhpArrayCache.php24
-rw-r--r--vendor/symfony/cache/Simple/PhpFilesCache.php7
-rw-r--r--vendor/symfony/cache/Simple/Psr6Cache.php251
-rw-r--r--vendor/symfony/cache/Simple/RedisCache.php7
-rw-r--r--vendor/symfony/cache/Simple/TraceableCache.php13
14 files changed, 108 insertions, 284 deletions
diff --git a/vendor/symfony/cache/Simple/AbstractCache.php b/vendor/symfony/cache/Simple/AbstractCache.php
index 7a2a3cb36e..312a7dbfd0 100644
--- a/vendor/symfony/cache/Simple/AbstractCache.php
+++ b/vendor/symfony/cache/Simple/AbstractCache.php
@@ -12,16 +12,20 @@
namespace Symfony\Component\Cache\Simple;
use Psr\Log\LoggerAwareInterface;
-use Psr\SimpleCache\CacheInterface;
+use Psr\SimpleCache\CacheInterface as Psr16CacheInterface;
+use Symfony\Component\Cache\Adapter\AbstractAdapter;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\Traits\AbstractTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', AbstractCache::class, AbstractAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
/**
- * @author Nicolas Grekas <p@tchwork.com>
+ * @deprecated since Symfony 4.3, use AbstractAdapter and type-hint for CacheInterface instead.
*/
-abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, ResettableInterface
+abstract class AbstractCache implements Psr16CacheInterface, LoggerAwareInterface, ResettableInterface
{
use AbstractTrait {
deleteItems as private;
@@ -52,7 +56,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
return $value;
}
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch key "{key}"', ['key' => $key, 'exception' => $e]);
+ CacheItem::log($this->logger, 'Failed to fetch key "{key}": '.$e->getMessage(), ['key' => $key, 'exception' => $e]);
}
return $default;
@@ -86,7 +90,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
try {
$values = $this->doFetch($ids);
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => $keys, 'exception' => $e]);
+ CacheItem::log($this->logger, 'Failed to fetch values: '.$e->getMessage(), ['keys' => $keys, 'exception' => $e]);
$values = [];
}
$ids = array_combine($ids, $keys);
@@ -125,7 +129,8 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
foreach (\is_array($e) ? $e : array_keys($valuesById) as $id) {
$keys[] = substr($id, \strlen($this->namespace));
}
- CacheItem::log($this->logger, 'Failed to save values', ['keys' => $keys, 'exception' => $e instanceof \Exception ? $e : null]);
+ $message = 'Failed to save values'.($e instanceof \Exception ? ': '.$e->getMessage() : '.');
+ CacheItem::log($this->logger, $message, ['keys' => $keys, 'exception' => $e instanceof \Exception ? $e : null]);
return false;
}
@@ -171,7 +176,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
yield $key => $value;
}
} catch (\Exception $e) {
- CacheItem::log($this->logger, 'Failed to fetch requested values', ['keys' => array_values($keys), 'exception' => $e]);
+ CacheItem::log($this->logger, 'Failed to fetch values: '.$e->getMessage(), ['keys' => array_values($keys), 'exception' => $e]);
}
foreach ($keys as $key) {
diff --git a/vendor/symfony/cache/Simple/ApcuCache.php b/vendor/symfony/cache/Simple/ApcuCache.php
index 0877c394bb..c22771e822 100644
--- a/vendor/symfony/cache/Simple/ApcuCache.php
+++ b/vendor/symfony/cache/Simple/ApcuCache.php
@@ -13,6 +13,11 @@ namespace Symfony\Component\Cache\Simple;
use Symfony\Component\Cache\Traits\ApcuTrait;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', ApcuCache::class, ApcuAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
+/**
+ * @deprecated since Symfony 4.3, use ApcuAdapter and type-hint for CacheInterface instead.
+ */
class ApcuCache extends AbstractCache
{
use ApcuTrait;
diff --git a/vendor/symfony/cache/Simple/ArrayCache.php b/vendor/symfony/cache/Simple/ArrayCache.php
index e36dacb829..3df5b4990c 100644
--- a/vendor/symfony/cache/Simple/ArrayCache.php
+++ b/vendor/symfony/cache/Simple/ArrayCache.php
@@ -12,16 +12,20 @@
namespace Symfony\Component\Cache\Simple;
use Psr\Log\LoggerAwareInterface;
-use Psr\SimpleCache\CacheInterface;
+use Psr\SimpleCache\CacheInterface as Psr16CacheInterface;
+use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\Traits\ArrayTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', ArrayCache::class, ArrayAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
/**
- * @author Nicolas Grekas <p@tchwork.com>
+ * @deprecated since Symfony 4.3, use ArrayAdapter and type-hint for CacheInterface instead.
*/
-class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInterface
+class ArrayCache implements Psr16CacheInterface, LoggerAwareInterface, ResettableInterface
{
use ArrayTrait {
ArrayTrait::deleteItem as delete;
diff --git a/vendor/symfony/cache/Simple/ChainCache.php b/vendor/symfony/cache/Simple/ChainCache.php
index 18e9462ba0..a0122fdee9 100644
--- a/vendor/symfony/cache/Simple/ChainCache.php
+++ b/vendor/symfony/cache/Simple/ChainCache.php
@@ -11,21 +11,25 @@
namespace Symfony\Component\Cache\Simple;
-use Psr\SimpleCache\CacheInterface;
+use Psr\SimpleCache\CacheInterface as Psr16CacheInterface;
+use Symfony\Component\Cache\Adapter\ChainAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
+use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Service\ResetInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', ChainCache::class, ChainAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
/**
* Chains several caches together.
*
* Cached items are fetched from the first cache having them in its data store.
* They are saved and deleted in all caches at once.
*
- * @author Nicolas Grekas <p@tchwork.com>
+ * @deprecated since Symfony 4.3, use ChainAdapter and type-hint for CacheInterface instead.
*/
-class ChainCache implements CacheInterface, PruneableInterface, ResettableInterface
+class ChainCache implements Psr16CacheInterface, PruneableInterface, ResettableInterface
{
private $miss;
private $caches = [];
@@ -33,8 +37,8 @@ class ChainCache implements CacheInterface, PruneableInterface, ResettableInterf
private $cacheCount;
/**
- * @param CacheInterface[] $caches The ordered list of caches used to fetch cached items
- * @param int $defaultLifetime The lifetime of items propagated from lower caches to upper ones
+ * @param Psr16CacheInterface[] $caches The ordered list of caches used to fetch cached items
+ * @param int $defaultLifetime The lifetime of items propagated from lower caches to upper ones
*/
public function __construct(array $caches, int $defaultLifetime = 0)
{
@@ -43,8 +47,8 @@ class ChainCache implements CacheInterface, PruneableInterface, ResettableInterf
}
foreach ($caches as $cache) {
- if (!$cache instanceof CacheInterface) {
- throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', \get_class($cache), CacheInterface::class));
+ if (!$cache instanceof Psr16CacheInterface) {
+ throw new InvalidArgumentException(sprintf('The class "%s" does not implement the "%s" interface.', \get_class($cache), Psr16CacheInterface::class));
}
}
diff --git a/vendor/symfony/cache/Simple/DoctrineCache.php b/vendor/symfony/cache/Simple/DoctrineCache.php
index 0ba701d7cd..6a6d003153 100644
--- a/vendor/symfony/cache/Simple/DoctrineCache.php
+++ b/vendor/symfony/cache/Simple/DoctrineCache.php
@@ -12,8 +12,15 @@
namespace Symfony\Component\Cache\Simple;
use Doctrine\Common\Cache\CacheProvider;
+use Symfony\Component\Cache\Adapter\DoctrineAdapter;
use Symfony\Component\Cache\Traits\DoctrineTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', DoctrineCache::class, DoctrineAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
+/**
+ * @deprecated since Symfony 4.3, use DoctrineAdapter and type-hint for CacheInterface instead.
+ */
class DoctrineCache extends AbstractCache
{
use DoctrineTrait;
diff --git a/vendor/symfony/cache/Simple/FilesystemCache.php b/vendor/symfony/cache/Simple/FilesystemCache.php
index 8e04d53355..8891abd94c 100644
--- a/vendor/symfony/cache/Simple/FilesystemCache.php
+++ b/vendor/symfony/cache/Simple/FilesystemCache.php
@@ -11,11 +11,18 @@
namespace Symfony\Component\Cache\Simple;
+use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Marshaller\DefaultMarshaller;
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Traits\FilesystemTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', FilesystemCache::class, FilesystemAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
+/**
+ * @deprecated since Symfony 4.3, use FilesystemAdapter and type-hint for CacheInterface instead.
+ */
class FilesystemCache extends AbstractCache implements PruneableInterface
{
use FilesystemTrait;
diff --git a/vendor/symfony/cache/Simple/MemcachedCache.php b/vendor/symfony/cache/Simple/MemcachedCache.php
index 8e418b071e..e1934119aa 100644
--- a/vendor/symfony/cache/Simple/MemcachedCache.php
+++ b/vendor/symfony/cache/Simple/MemcachedCache.php
@@ -11,9 +11,16 @@
namespace Symfony\Component\Cache\Simple;
+use Symfony\Component\Cache\Adapter\MemcachedAdapter;
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
use Symfony\Component\Cache\Traits\MemcachedTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', MemcachedCache::class, MemcachedAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
+/**
+ * @deprecated since Symfony 4.3, use MemcachedAdapter and type-hint for CacheInterface instead.
+ */
class MemcachedCache extends AbstractCache
{
use MemcachedTrait;
diff --git a/vendor/symfony/cache/Simple/NullCache.php b/vendor/symfony/cache/Simple/NullCache.php
index fa986aebd1..d1ca6f7187 100644
--- a/vendor/symfony/cache/Simple/NullCache.php
+++ b/vendor/symfony/cache/Simple/NullCache.php
@@ -11,12 +11,16 @@
namespace Symfony\Component\Cache\Simple;
-use Psr\SimpleCache\CacheInterface;
+use Psr\SimpleCache\CacheInterface as Psr16CacheInterface;
+use Symfony\Components\Cache\Adapter\NullAdapter;
+use Symfony\Contracts\Cache\CacheInterface;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', NullCache::class, NullAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
/**
- * @author Nicolas Grekas <p@tchwork.com>
+ * @deprecated since Symfony 4.3, use NullAdapter and type-hint for CacheInterface instead.
*/
-class NullCache implements CacheInterface
+class NullCache implements Psr16CacheInterface
{
/**
* {@inheritdoc}
diff --git a/vendor/symfony/cache/Simple/PdoCache.php b/vendor/symfony/cache/Simple/PdoCache.php
index 521e9b8f2d..07849e93fe 100644
--- a/vendor/symfony/cache/Simple/PdoCache.php
+++ b/vendor/symfony/cache/Simple/PdoCache.php
@@ -11,10 +11,17 @@
namespace Symfony\Component\Cache\Simple;
+use Symfony\Component\Cache\Adapter\PdoAdapter;
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Traits\PdoTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', PdoCache::class, PdoAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
+/**
+ * @deprecated since Symfony 4.3, use PdoAdapter and type-hint for CacheInterface instead.
+ */
class PdoCache extends AbstractCache implements PruneableInterface
{
use PdoTrait;
diff --git a/vendor/symfony/cache/Simple/PhpArrayCache.php b/vendor/symfony/cache/Simple/PhpArrayCache.php
index 6ba8527885..566609359d 100644
--- a/vendor/symfony/cache/Simple/PhpArrayCache.php
+++ b/vendor/symfony/cache/Simple/PhpArrayCache.php
@@ -11,28 +11,28 @@
namespace Symfony\Component\Cache\Simple;
-use Psr\SimpleCache\CacheInterface;
+use Psr\SimpleCache\CacheInterface as Psr16CacheInterface;
+use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
use Symfony\Component\Cache\Traits\PhpArrayTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', PhpArrayCache::class, PhpArrayAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
/**
- * Caches items at warm up time using a PHP array that is stored in shared memory by OPCache since PHP 7.0.
- * Warmed up items are read-only and run-time discovered items are cached using a fallback adapter.
- *
- * @author Titouan Galopin <galopintitouan@gmail.com>
- * @author Nicolas Grekas <p@tchwork.com>
+ * @deprecated since Symfony 4.3, use PhpArrayAdapter and type-hint for CacheInterface instead.
*/
-class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInterface
+class PhpArrayCache implements Psr16CacheInterface, PruneableInterface, ResettableInterface
{
use PhpArrayTrait;
/**
- * @param string $file The PHP file were values are cached
- * @param CacheInterface $fallbackPool A pool to fallback on when an item is not hit
+ * @param string $file The PHP file were values are cached
+ * @param Psr16CacheInterface $fallbackPool A pool to fallback on when an item is not hit
*/
- public function __construct(string $file, CacheInterface $fallbackPool)
+ public function __construct(string $file, Psr16CacheInterface $fallbackPool)
{
$this->file = $file;
$this->pool = $fallbackPool;
@@ -43,9 +43,9 @@ class PhpArrayCache implements CacheInterface, PruneableInterface, ResettableInt
*
* @param string $file The PHP file were values are cached
*
- * @return CacheInterface
+ * @return Psr16CacheInterface
*/
- public static function create($file, CacheInterface $fallbackPool)
+ public static function create($file, Psr16CacheInterface $fallbackPool)
{
// Shared memory is available in PHP 7.0+ with OPCache enabled
if (filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
diff --git a/vendor/symfony/cache/Simple/PhpFilesCache.php b/vendor/symfony/cache/Simple/PhpFilesCache.php
index 37432c5af8..060244a086 100644
--- a/vendor/symfony/cache/Simple/PhpFilesCache.php
+++ b/vendor/symfony/cache/Simple/PhpFilesCache.php
@@ -11,10 +11,17 @@
namespace Symfony\Component\Cache\Simple;
+use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
use Symfony\Component\Cache\Exception\CacheException;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Traits\PhpFilesTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', PhpFilesCache::class, PhpFilesAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
+/**
+ * @deprecated since Symfony 4.3, use PhpFilesAdapter and type-hint for CacheInterface instead.
+ */
class PhpFilesCache extends AbstractCache implements PruneableInterface
{
use PhpFilesTrait;
diff --git a/vendor/symfony/cache/Simple/Psr6Cache.php b/vendor/symfony/cache/Simple/Psr6Cache.php
index fceb9ba70f..090f48c172 100644
--- a/vendor/symfony/cache/Simple/Psr6Cache.php
+++ b/vendor/symfony/cache/Simple/Psr6Cache.php
@@ -11,254 +11,13 @@
namespace Symfony\Component\Cache\Simple;
-use Psr\Cache\CacheException as Psr6CacheException;
-use Psr\Cache\CacheItemPoolInterface;
-use Psr\SimpleCache\CacheException as SimpleCacheException;
-use Psr\SimpleCache\CacheInterface;
-use Symfony\Component\Cache\Adapter\AdapterInterface;
-use Symfony\Component\Cache\CacheItem;
-use Symfony\Component\Cache\Exception\InvalidArgumentException;
-use Symfony\Component\Cache\PruneableInterface;
-use Symfony\Component\Cache\ResettableInterface;
-use Symfony\Component\Cache\Traits\ProxyTrait;
+use Symfony\Component\Cache\Psr16Cache;
+
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" instead.', Psr6Cache::class, Psr16Cache::class), E_USER_DEPRECATED);
/**
- * @author Nicolas Grekas <p@tchwork.com>
+ * @deprecated since Symfony 4.3, use Psr16Cache instead.
*/
-class Psr6Cache implements CacheInterface, PruneableInterface, ResettableInterface
+class Psr6Cache extends Psr16Cache
{
- use ProxyTrait;
-
- private const METADATA_EXPIRY_OFFSET = 1527506807;
-
- private $createCacheItem;
- private $cacheItemPrototype;
-
- public function __construct(CacheItemPoolInterface $pool)
- {
- $this->pool = $pool;
-
- if (!$pool instanceof AdapterInterface) {
- return;
- }
- $cacheItemPrototype = &$this->cacheItemPrototype;
- $createCacheItem = \Closure::bind(
- function ($key, $value, $allowInt = false) use (&$cacheItemPrototype) {
- $item = clone $cacheItemPrototype;
- $item->key = $allowInt && \is_int($key) ? (string) $key : CacheItem::validateKey($key);
- $item->value = $value;
- $item->isHit = false;
-
- return $item;
- },
- null,
- CacheItem::class
- );
- $this->createCacheItem = function ($key, $value, $allowInt = false) use ($createCacheItem) {
- if (null === $this->cacheItemPrototype) {
- $this->get($allowInt && \is_int($key) ? (string) $key : $key);
- }
- $this->createCacheItem = $createCacheItem;
-
- return $createCacheItem($key, null, $allowInt)->set($value);
- };
- }
-
- /**
- * {@inheritdoc}
- */
- public function get($key, $default = null)
- {
- try {
- $item = $this->pool->getItem($key);
- } catch (SimpleCacheException $e) {
- throw $e;
- } catch (Psr6CacheException $e) {
- throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
- }
- if (null === $this->cacheItemPrototype) {
- $this->cacheItemPrototype = clone $item;
- $this->cacheItemPrototype->set(null);
- }
-
- return $item->isHit() ? $item->get() : $default;
- }
-
- /**
- * {@inheritdoc}
- */
- public function set($key, $value, $ttl = null)
- {
- try {
- if (null !== $f = $this->createCacheItem) {
- $item = $f($key, $value);
- } else {
- $item = $this->pool->getItem($key)->set($value);
- }
- } catch (SimpleCacheException $e) {
- throw $e;
- } catch (Psr6CacheException $e) {
- throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
- }
- if (null !== $ttl) {
- $item->expiresAfter($ttl);
- }
-
- return $this->pool->save($item);
- }
-
- /**
- * {@inheritdoc}
- */
- public function delete($key)
- {
- try {
- return $this->pool->deleteItem($key);
- } catch (SimpleCacheException $e) {
- throw $e;
- } catch (Psr6CacheException $e) {
- throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function clear()
- {
- return $this->pool->clear();
- }
-
- /**
- * {@inheritdoc}
- */
- public function getMultiple($keys, $default = null)
- {
- if ($keys instanceof \Traversable) {
- $keys = iterator_to_array($keys, false);
- } elseif (!\is_array($keys)) {
- throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
- }
-
- try {
- $items = $this->pool->getItems($keys);
- } catch (SimpleCacheException $e) {
- throw $e;
- } catch (Psr6CacheException $e) {
- throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
- }
- $values = [];
-
- if (!$this->pool instanceof AdapterInterface) {
- foreach ($items as $key => $item) {
- $values[$key] = $item->isHit() ? $item->get() : $default;
- }
-
- return $values;
- }
-
- foreach ($items as $key => $item) {
- if (!$item->isHit()) {
- $values[$key] = $default;
- continue;
- }
- $values[$key] = $item->get();
-
- if (!$metadata = $item->getMetadata()) {
- continue;
- }
- unset($metadata[CacheItem::METADATA_TAGS]);
-
- if ($metadata) {
- $values[$key] = ["\x9D".pack('VN', (int) $metadata[CacheItem::METADATA_EXPIRY] - self::METADATA_EXPIRY_OFFSET, $metadata[CacheItem::METADATA_CTIME])."\x5F" => $values[$key]];
- }
- }
-
- return $values;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setMultiple($values, $ttl = null)
- {
- $valuesIsArray = \is_array($values);
- if (!$valuesIsArray && !$values instanceof \Traversable) {
- throw new InvalidArgumentException(sprintf('Cache values must be array or Traversable, "%s" given', \is_object($values) ? \get_class($values) : \gettype($values)));
- }
- $items = [];
-
- try {
- if (null !== $f = $this->createCacheItem) {
- $valuesIsArray = false;
- foreach ($values as $key => $value) {
- $items[$key] = $f($key, $value, true);
- }
- } elseif ($valuesIsArray) {
- $items = [];
- foreach ($values as $key => $value) {
- $items[] = (string) $key;
- }
- $items = $this->pool->getItems($items);
- } else {
- foreach ($values as $key => $value) {
- if (\is_int($key)) {
- $key = (string) $key;
- }
- $items[$key] = $this->pool->getItem($key)->set($value);
- }
- }
- } catch (SimpleCacheException $e) {
- throw $e;
- } catch (Psr6CacheException $e) {
- throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
- }
- $ok = true;
-
- foreach ($items as $key => $item) {
- if ($valuesIsArray) {
- $item->set($values[$key]);
- }
- if (null !== $ttl) {
- $item->expiresAfter($ttl);
- }
- $ok = $this->pool->saveDeferred($item) && $ok;
- }
-
- return $this->pool->commit() && $ok;
- }
-
- /**
- * {@inheritdoc}
- */
- public function deleteMultiple($keys)
- {
- if ($keys instanceof \Traversable) {
- $keys = iterator_to_array($keys, false);
- } elseif (!\is_array($keys)) {
- throw new InvalidArgumentException(sprintf('Cache keys must be array or Traversable, "%s" given', \is_object($keys) ? \get_class($keys) : \gettype($keys)));
- }
-
- try {
- return $this->pool->deleteItems($keys);
- } catch (SimpleCacheException $e) {
- throw $e;
- } catch (Psr6CacheException $e) {
- throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function has($key)
- {
- try {
- return $this->pool->hasItem($key);
- } catch (SimpleCacheException $e) {
- throw $e;
- } catch (Psr6CacheException $e) {
- throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
- }
- }
}
diff --git a/vendor/symfony/cache/Simple/RedisCache.php b/vendor/symfony/cache/Simple/RedisCache.php
index df2a96e86b..2933bf15b3 100644
--- a/vendor/symfony/cache/Simple/RedisCache.php
+++ b/vendor/symfony/cache/Simple/RedisCache.php
@@ -11,9 +11,16 @@
namespace Symfony\Component\Cache\Simple;
+use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\Cache\Marshaller\MarshallerInterface;
use Symfony\Component\Cache\Traits\RedisTrait;
+use Symfony\Contracts\Cache\CacheInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', RedisCache::class, RedisAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
+/**
+ * @deprecated since Symfony 4.3, use RedisAdapter and type-hint for CacheInterface instead.
+ */
class RedisCache extends AbstractCache
{
use RedisTrait;
diff --git a/vendor/symfony/cache/Simple/TraceableCache.php b/vendor/symfony/cache/Simple/TraceableCache.php
index 2db335ac96..ad9bfcf09c 100644
--- a/vendor/symfony/cache/Simple/TraceableCache.php
+++ b/vendor/symfony/cache/Simple/TraceableCache.php
@@ -11,23 +11,24 @@
namespace Symfony\Component\Cache\Simple;
-use Psr\SimpleCache\CacheInterface;
+use Psr\SimpleCache\CacheInterface as Psr16CacheInterface;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\ResettableInterface;
+use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Service\ResetInterface;
+@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.3, use "%s" and type-hint for "%s" instead.', TraceableCache::class, TraceableAdapter::class, CacheInterface::class), E_USER_DEPRECATED);
+
/**
- * An adapter that collects data about all cache calls.
- *
- * @author Nicolas Grekas <p@tchwork.com>
+ * @deprecated since Symfony 4.3, use TraceableAdapter and type-hint for CacheInterface instead.
*/
-class TraceableCache implements CacheInterface, PruneableInterface, ResettableInterface
+class TraceableCache implements Psr16CacheInterface, PruneableInterface, ResettableInterface
{
private $pool;
private $miss;
private $calls = [];
- public function __construct(CacheInterface $pool)
+ public function __construct(Psr16CacheInterface $pool)
{
$this->pool = $pool;
$this->miss = new \stdClass();