public function getMetadata(string $class): ClassMetadata
    {
        if (isset($this->metadatas[$class])) {
            return $this->metadatas[$class];
        }

        $item = $this->cache->getItem(str_replace('\\', '.', $class));

        if ($item->isHit()) {
            return $this->metadatas[$class] = $item->get();
        }

        $metadata = $this->metadatas[$class] = $this->factory->getMetadata($class);
        $item->set($metadata);

        $this->cache->save($item);

        return $metadata;
    }
public function getMetadata(string $class): ClassMetadata
    {
        if (isset($this->metadatas[$class])) {
            return $this->metadatas[$class];
        }

        $item = $this->cache->getItem(str_replace('\\', '.', $class));

        if ($item->isHit()) {
            return $this->metadatas[$class] = $item->get();
        }

        $metadata = $this->metadatas[$class] = $this->factory->getMetadata($class);
        $item->set($metadata);

        $this->cache->save($item);

        return $metadata;
    }
{@inheritdoc}