Cache the entire homepage for 5 minutes.

This means that comments and blog posts will take at most 5 minutes to show
up on /.
This commit is contained in:
2017-09-15 17:46:20 +02:00
parent 0b61e517d2
commit 9a692d475b
2 changed files with 14 additions and 0 deletions

View File

@@ -28,6 +28,10 @@ def homepage():
if current_user.is_anonymous:
return redirect(url_for('cloud.welcome'))
return _render_homepage()
def _render_homepage():
# Get latest blog posts
api = system_util.pillar_api()
latest_posts = Node.all({
@@ -319,3 +323,10 @@ def billing():
return render_template(
'users/settings/billing.html',
store_user=store_user, groups=groups, title='billing')
def setup_app(app):
global _render_homepage
cache = app.cache.cached(300)
_render_homepage = cache(_render_homepage)