From 0cad11004f148bad4894e3040d1708b50b7511d1 Mon Sep 17 00:00:00 2001 From: Albert S Date: Wed, 17 Aug 2022 21:55:55 +0200 Subject: [PATCH] HandlerPageView: Drop partial caches Anonymous access is the common case, this is already cached. For other cases this logic cannot be justified as there is hardly a practical gain for that extra complexity. --- handlers/handlerpageview.cpp | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/handlers/handlerpageview.cpp b/handlers/handlerpageview.cpp index c16d224..1588114 100644 --- a/handlers/handlerpageview.cpp +++ b/handlers/handlerpageview.cpp @@ -186,36 +186,8 @@ Response HandlerPageView::handleRequest(PageDao &pageDao, std::string pagename, dynamicVarsMap["createdon"] = utils::toISODate(firstRevision.value().timestamp); std::string resolvedContent = parser.parseDynamics(revision->content, dynamicParseCallback); - if(revisionid > 0) - { - indexcontent = createIndexContent(parser, resolvedContent); - parsedcontent = parser.parse(pageDao, *this->urlProvider, resolvedContent); - } - else - { - std::string cachekeyindexcontent = "page:indexcontent:" + pagename; - std::string cachekeyparsedcontent = "page:parsedcontent:" + pagename; - auto cachedindexcontent = this->cache->get(cachekeyindexcontent); - auto cachedparsedcontent = this->cache->get(cachekeyparsedcontent); - if(cachedindexcontent) - { - indexcontent = *cachedindexcontent; - } - else - { - indexcontent = createIndexContent(parser, resolvedContent); - this->cache->put(cachekeyindexcontent, indexcontent); - } - if(cachedparsedcontent) - { - parsedcontent = *cachedparsedcontent; - } - else - { - parsedcontent = parser.parse(pageDao, *this->urlProvider, resolvedContent); - this->cache->put(cachekeyparsedcontent, parsedcontent); - } - } + indexcontent = createIndexContent(parser, resolvedContent); + parsedcontent = parser.parse(pageDao, *this->urlProvider, resolvedContent); std::string revisionstr = std::to_string(revision->revision); std::string customtitle = parser.extractCommand("pagetitle", revision->content); page.setVar("content", parsedcontent);