From d1326ba40b03d9edf5b55f834de4e270707fc4a1 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Sun, 26 May 2024 15:41:24 +0200 Subject: [PATCH] perf: cache rendered routes --- threads.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/threads.py b/threads.py index eef248d..6fae3d6 100755 --- a/threads.py +++ b/threads.py @@ -46,11 +46,13 @@ def middleware(): attribution['current_year'] = year @threads.route('/') +@cache.cached(timeout=300) async def home(): statuses = await fetch_statuses() return render_template('threads.html', threads=statuses, app=app, attribution=attribution, render_date=datetime.now()) @threads.route('/') +@cache.cached(timeout=300) def thread(id): if id in thread_ids: status = fetch_thread(id)