protected function getCacheDriver($cacheNamespace, CacheProvider $cacheDriver = null)
    {
        if (!$cacheDriver instanceof CacheProvider) {
            $cacheDriver = clone $this->getMetadataCacheDriver();
            $cacheDriver->setNamespace($cacheNamespace);
        }

        if ($cacheDriver->getNamespace() === '') {
            $cacheDriver->setNamespace($cacheNamespace);
        }

        return $cacheDriver;
    }