Cache template content from the CMS Wiki
Closed, DeclinedPublic2 Story Points

Description

At the moment, every template rendering causes a request to the CMS Wiki, which will create performance problems when going live.

This is because the Twig_Loader_Chain expects an exception when a loader is asked for the cache key of a template which doesn't exist. At the moment this is "solved" by trying to load the page from the wiki in WMDE\Fundraising\Frontend\Presentation\Content\TwigPageLoader::getCacheKey which causes the request. We can't just simply remove the request because the the TwigPageLoader would simply grab all templates form the wiki and our file-based templates would be ignored.

So caching has to be introduced somewhere in the TwigPageLoader -> WikiContentProvider -> PageRetriever classes:

    • When adding the cache to TwigPageLoader, getCacheKey and isFresh must interact with the cache class, throwing the exception if necessary.
  • When adding the cache class to WikiContentProvider or PageRetriever, TwigPageLoader does not need to be modified, it will throw the exception if the content is empty.
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 6 2016, 2:42 PM

In my opinion, adding the cache to WikiContentProvider or PageRetriever would be the better option.

kai.nissen moved this task from Incoming to WMDE Fundraising on the TCB-Team board.Jul 6 2016, 3:32 PM

I'll tackle this as part of https://phabricator.wikimedia.org/T138964. Presumably going to create a caching decorator for PageRetriever (which is now implemented by WikiContentProvider)

gabriel-wmde closed this task as "Declined".Apr 7 2017, 8:10 AM

No longer needed, see T157560

Restricted Application added a project: WMDE-Fun-Team. · View Herald TranscriptApr 7 2017, 8:10 AM