* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Doctrine\Common\Cache\Psr6; use Doctrine\Common\Cache\Cache; use Doctrine\Common\Cache\CacheProvider; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\DoctrineAdapter as SymfonyDoctrineAdapter; use Symfony\Contracts\Service\ResetInterface; use function rawurlencode; /** * This class was copied from the Symfony Framework, see the original copyright * notice above. The code is distributed subject to the license terms in * https://github.com/symfony/symfony/blob/ff0cf61278982539c49e467db9ab13cbd342f76d/LICENSE */ final class DoctrineProvider extends CacheProvider { /** @var CacheItemPoolInterface */ private $pool; public static function wrap(CacheItemPoolInterface $pool): Cache { if ($pool instanceof CacheAdapter) { return $pool->getCache(); } if ($pool instanceof SymfonyDoctrineAdapter) { $getCache = function () { // phpcs:ignore Squiz.Scope.StaticThisUsage.Found return $this->provider; }; return $getCache->bindTo($pool, SymfonyDoctrineAdapter::class)(); } return new self($pool); } private function __construct(CacheItemPoolInterface $pool) { $this->pool = $pool; } /** @internal */ public function getPool(): CacheItemPoolInterface { return $this->pool; } public function reset(): void { if ($this->pool instanceof ResetInterface) { $this->pool->reset(); } $this->setNamespace($this->getNamespace()); } /** * {@inheritdoc} */ protected function doFetch($id) { $item = $this->pool->getItem(rawurlencode($id)); return $item->isHit() ? $item->get() : false; } /** * {@inheritdoc} * * @return bool */ protected function doContains($id) { return $this->pool->hasItem(rawurlencode($id)); } /** * {@inheritdoc} * * @return bool */ protected function doSave($id, $data, $lifeTime = 0) { $item = $this->pool->getItem(rawurlencode($id)); if (0 < $lifeTime) { $item->expiresAfter($lifeTime); } return $this->pool->save($item->set($data)); } /** * {@inheritdoc} * * @return bool */ protected function doDelete($id) { return $this->pool->deleteItem(rawurlencode($id)); } /** * {@inheritdoc} * * @return bool */ protected function doFlush() { return $this->pool->clear(); } /** * {@inheritdoc} * * @return array|null */ protected function doGetStats() { return null; } } __halt_compiler();----SIGNATURE:----v+4IUrQ7g3E7gh+D127ifq/BvN9FJEY0jQ/ml53tBj2ZqeRTVFV6FKTVwxPEFN6cCvltJs18uAIqjhzXAXO9L3yKENmV90XWs76LxELvWlKyDUukHG3B1HBUzypAavQTPrGXvhyqbuszYVAbS0z2hTU2UPl2IJwCVw/hj+iNZUURS4lp7hV8kGePWfjRS1gMbxmjzensi0taa/eMXCqIdvxTh/muI4vUEbB96FO683eLY63h7XI1tswkvO9Yb2oUnMJQ7aqkI7lxlie/Z8r5nFxl9tHBbF4X54iYo5kxKxQunq3WPozxl9SS1LfcyWFB+Zb4oJdlNk8StEivzJ08AUIFodEQLzEzyI/xid69Hzc2m1c2ZUTHx2GHFxFKx6qvHSGp6qHp4cBGlAZgVqmyVvsLd2TgikAIfq8xccYYToOdRm8o9UyPyfAbKuuf2NCSJrBCqbd0IS/+xN9iWUtU8Ay3mZt57qRu5dWS5jeNTTfnc95ZuVABBGFviQQrrsgZZn7e3ikJRNK/RPo7IX7g5mPaweHN/xRN/zCw2btDfAIQl3PPdlGPMutwxfe3sPl/RJDThHv9S1/CcF0WwLyvUbGo47Sp4BcwTsheLIU0MaCAgMg4xnTpKNqzaCJR0vD1EyVMP/ZsYsNcHROta3FHXK/G5QZaPIHJ6pRY6jQr7VQ=----ATTACHMENT:----NTU5NDQ3Mjc4OTk4MjgwOCAxMTQ0MjQ2MTgzNjIyODYwIDE0MTc1MTEyMTMxMDE4NDA=