From b4b07a3e083f32686c1fb0461925286e0b05e9ea Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Wed, 1 May 2013 16:27:35 -0700 Subject: [PATCH] Cache registration info html in memcache. --- r2/r2/lib/pages/pages.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 5605f896f..6821c2664 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -960,12 +960,15 @@ class Register(Login): class RegistrationInfo(Templated): def __init__(self): - wp = WikiPage.get(Frontpage, g.wiki_page_registration_info) - html = unsafe( - wikimarkdown(wp.content, include_toc=False, target='_blank') - ) + html = unsafe(self.get_registration_info_html()) Templated.__init__(self, content_html=html) + @classmethod + @memoize('registration_info_html', time=10*60) + def get_registration_info_html(cls): + wp = WikiPage.get(Frontpage, g.wiki_page_registration_info) + return wikimarkdown(wp.content, include_toc=False, target='_blank') + class OAuth2AuthorizationPage(BoringPage): def __init__(self, client, redirect_uri, scope, state, duration):