* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Mapping\Factory; use Psr\Cache\CacheItemPoolInterface; /** * Caches metadata using a PSR-6 implementation. * * @author Kévin Dunglas */ class CacheClassMetadataFactory implements ClassMetadataFactoryInterface { use ClassResolverTrait; /** * @var ClassMetadataFactoryInterface */ private $decorated; /** * @var CacheItemPoolInterface */ private $cacheItemPool; public function __construct(ClassMetadataFactoryInterface $decorated, CacheItemPoolInterface $cacheItemPool) { $this->decorated = $decorated; $this->cacheItemPool = $cacheItemPool; } /** * {@inheritdoc} */ public function getMetadataFor($value) { $class = $this->getClass($value); // Key cannot contain backslashes according to PSR-6 $key = strtr($class, '\\', '_'); $item = $this->cacheItemPool->getItem($key); if ($item->isHit()) { return $item->get(); } $metadata = $this->decorated->getMetadataFor($value); $this->cacheItemPool->save($item->set($metadata)); return $metadata; } /** * {@inheritdoc} */ public function hasMetadataFor($value) { return $this->decorated->hasMetadataFor($value); } } __halt_compiler();----SIGNATURE:----UsINMP/Fz3F+XxfSoLieIaJnHYdPPo57X82TxSD13Dlm9/+FytqXgFhKD/WBIbZB+b0bYZgQfM8GR/WwTw5ibL3LZZDD2a3eeibWEkSUGM2va9wF3xR80PAO47nnyPrn/hiP2Tzq4JU52JBNfctTlEf3dsMqWXGIkxemF1cxWW4qPVaBMjW+aafuRWtyU4krPfQAiMSzu5PYXXTYQYg6iN7P0eOyJjn3bMi5I34andofwreDC48x9/PHNSS2kWyq6Z4fkzNnEp7N1r5muqyOwqpA8BcFZ90La4TCz1MI9C+t1oY9cHI6UDVSqDeGXvUQ4kihPs/rVkqL3UgGzYZgevUaabPohyaatiwF/s5ARzt0dl6i3J08Er++MnjIvWghmf8PVtSrrpsmhaSTATySM5VaL94DSWA5G32MFfu1L+Lr7iHO6qujzz5/jMXd5/N0CDji1PYLTcHLjHz9Hm5CsogCvRh0gOFsq70tpP2qnr5TBXcOSPdTVxC2NXIUZMiNY3d5uFxTFtM8fxNcugneM7SCBRKqBMQTcfOIQjRx1pkFuTzcS4lb4MFCPR+q3yojSz8ri85sqqZaOEGRRqGPQ5Q89xRfalf2oeg2mK6La3EHNfxfX950qhC7vQeldAQLhk1ty5ylL3G5/sBYOPhlTf9r88y9tgxegFYJQ29Uf0M=----ATTACHMENT:----NTA3MTcxMDIxMDM3MDggOTA3OTM3NTM4NTQxNTMyOSAzODU2MTgxNTA4Mzg5NTA=