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
This commit is contained in:
Nicolas F 2019-03-08 15:29:51 +01:00 committed by Arylide
parent 585e1aeae7
commit 6a63ee241a
1 changed files with 2 additions and 0 deletions

View File

@ -93,6 +93,7 @@
</div>
</div>
{% cache 86400, "filelist", torrent.info_hash_as_hex %}
{% if files and files.__len__() <= config.MAX_FILES_VIEW %}
<div class="panel panel-default">
<div class="panel-heading">
@ -133,6 +134,7 @@
</div>
</div>
{% endif %}
{% endcache %}
<div id="comments" class="panel panel-default">
<div class="panel-heading">