public function getCategoryUri($oCat, $iLang = null, $blRegenerate = false)
    {
        startProfile(__FUNCTION__);
        $sCatId = $oCat->getId();

        // skipping external category URLs
        if ($oCat->oxcategories__oxextlink->value) {
            $sSeoUrl = null;
        } else {
            // not found in cache, process it from the top
            if (!isset($iLang)) {
                $iLang = $oCat->getLanguage();
            }

            $aCacheMap = [];
            $aStdLinks = [];

            while ($oCat && !($sSeoUrl = $this->_categoryUrlLoader($oCat, $iLang))) {
                if ($iLang != $oCat->getLanguage()) {
                    $sId = $oCat->getId();
                    $oCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
                    $oCat->loadInLang($iLang, $sId);
                }

                // prepare oCat title part
                $sTitle = $this->_prepareTitle($oCat->oxcategories__oxtitle->value, false, $oCat->getLanguage());

                foreach (array_keys($aCacheMap) as $id) {
                    $aCacheMap[$id] = $sTitle . '/' . $aCacheMap[$id];
                }

                $aCacheMap[$oCat->getId()] = $sTitle;
                $aStdLinks[$oCat->getId()] = $oCat->getBaseStdLink($iLang);

                // load parent
                $oCat = $oCat->getParentCategory();
            }

            foreach ($aCacheMap as $sId => $sUri) {
                $this->_aCatCache[$sId . '_' . $iLang] = $this->_processSeoUrl($sSeoUrl . $sUri . '/', $sId, $iLang);
                $this->_saveToDb('oxcategory', $sId, $aStdLinks[$sId], $this->_aCatCache[$sId . '_' . $iLang], $iLang);
            }

            $sSeoUrl = $this->_aCatCache[$sCatId . '_' . $iLang];
        }

        stopProfile(__FUNCTION__);

        return $sSeoUrl;
    }