Skip to content

Commit 1832976

Browse files
committed
Added caching for the /doc/active page.
- Legacy-Id: 18625
1 parent 101e8e2 commit 1832976

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ietf/doc/views_search.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,11 @@ def index_all_drafts(request):
544544
return render(request, 'doc/index_all_drafts.html', { "categories": categories })
545545

546546
def index_active_drafts(request):
547-
groups = active_drafts_index_by_group()
548-
547+
cache_key = 'doc:index_active_drafts'
548+
groups = cache.get(cache_key)
549+
if not groups:
550+
groups = active_drafts_index_by_group()
551+
cache.set(cache_key, groups, 15*60)
549552
return render(request, "doc/index_active_drafts.html", { 'groups': groups })
550553

551554
def ajax_select2_search_docs(request, model_name, doc_type):

ietf/templates/doc/index_active_drafts.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
{# Copyright The IETF Trust 2015, All Rights Reserved #}
33
{% load origin %}
44
{% load static %}
5+
{% load cache %}
56
{% block title %}Active Internet-Drafts{% endblock %}
67

78
{% block content %}
9+
{% cache 900 ietf_doc_index_active_drafts %}
810
{% origin %}
911
<h1>Active Internet-Drafts</h1>
1012

@@ -35,5 +37,5 @@ <h2 class="anchor-target" id="{{ group.acronym }}">{{ group.name }} ({{ group.ac
3537
</p>
3638
{% endfor %}
3739
{% endfor %}
38-
40+
{% endcache %}
3941
{% endblock %}

0 commit comments

Comments
 (0)