Check for cache before setting up the MD parser
This commit is contained in:
parent
b8956614b0
commit
8ed69831ee
1 changed files with 8 additions and 8 deletions
|
@ -26,6 +26,14 @@ class AntMarkdown
|
|||
$cache = new AntCache();
|
||||
$cacheKey = $cache->createCacheKey($md, 'markdown');
|
||||
|
||||
if ($cache->isCached($cacheKey)) {
|
||||
$cachedContent = $cache->getCache($cacheKey);
|
||||
|
||||
if ($cachedContent !== false && !empty($cachedContent)) {
|
||||
return $cachedContent;
|
||||
}
|
||||
}
|
||||
|
||||
$mdConfig = [
|
||||
'embed' => [
|
||||
'adapter' => new OscaroteroEmbedAdapter(),
|
||||
|
@ -46,14 +54,6 @@ class AntMarkdown
|
|||
|
||||
$converter = new MarkdownConverter($environment);
|
||||
|
||||
if ($cache->isCached($cacheKey)) {
|
||||
$cachedContent = $cache->getCache($cacheKey);
|
||||
|
||||
if ($cachedContent !== false && !empty($cachedContent)) {
|
||||
return $cachedContent;
|
||||
}
|
||||
}
|
||||
|
||||
$result = $converter->convert($md);
|
||||
|
||||
$cache->setCache($cacheKey, $result);
|
||||
|
|
Loading…
Reference in a new issue