From 6a63ee241afc032ce332d9832b775f601905db08 Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Fri, 8 Mar 2019 15:29:51 +0100 Subject: [PATCH] templates: cache torrent view filelist (#542) * templates: cache torrent view filelist Using flask-caching, we can add a 1 hour cache to the template output of a filelist, varying it by the key "filelist" + the hex infohash of a torrent. Using a very big filelist as a test, I get a difference in page load speeds of about a magnitude. (400ms -> 37 ms) * templates: increase filelist cache to 24 hours --- nyaa/templates/view.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nyaa/templates/view.html b/nyaa/templates/view.html index 027592e..7be7b18 100644 --- a/nyaa/templates/view.html +++ b/nyaa/templates/view.html @@ -93,6 +93,7 @@ +{% cache 86400, "filelist", torrent.info_hash_as_hex %} {% if files and files.__len__() <= config.MAX_FILES_VIEW %}
@@ -133,6 +134,7 @@
{% endif %} +{% endcache %}