Added caching for the /doc/active page.

- Legacy-Id: 18625
This commit is contained in:
Henrik Levkowetz 2020-10-22 11:25:24 +00:00
parent 101e8e22c2
commit 1832976b94
2 changed files with 8 additions and 3 deletions

View file

@ -544,8 +544,11 @@ def index_all_drafts(request):
return render(request, 'doc/index_all_drafts.html', { "categories": categories }) return render(request, 'doc/index_all_drafts.html', { "categories": categories })
def index_active_drafts(request): def index_active_drafts(request):
groups = active_drafts_index_by_group() cache_key = 'doc:index_active_drafts'
groups = cache.get(cache_key)
if not groups:
groups = active_drafts_index_by_group()
cache.set(cache_key, groups, 15*60)
return render(request, "doc/index_active_drafts.html", { 'groups': groups }) return render(request, "doc/index_active_drafts.html", { 'groups': groups })
def ajax_select2_search_docs(request, model_name, doc_type): def ajax_select2_search_docs(request, model_name, doc_type):

View file

@ -2,9 +2,11 @@
{# Copyright The IETF Trust 2015, All Rights Reserved #} {# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %} {% load origin %}
{% load static %} {% load static %}
{% load cache %}
{% block title %}Active Internet-Drafts{% endblock %} {% block title %}Active Internet-Drafts{% endblock %}
{% block content %} {% block content %}
{% cache 900 ietf_doc_index_active_drafts %}
{% origin %} {% origin %}
<h1>Active Internet-Drafts</h1> <h1>Active Internet-Drafts</h1>
@ -35,5 +37,5 @@
</p> </p>
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% endcache %}
{% endblock %} {% endblock %}