From d0ed0a0a6230a5cfe67aa0a2c3eca9450b96be77 Mon Sep 17 00:00:00 2001 From: Daan Sprenkels Date: Fri, 25 Oct 2019 19:28:52 +0200 Subject: [PATCH] Set all cache TTLs to 2 days Fixes #15. --- marietje/stats/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/marietje/stats/utils.py b/marietje/stats/utils.py index fcfeb4a..2be61fc 100644 --- a/marietje/stats/utils.py +++ b/marietje/stats/utils.py @@ -10,10 +10,12 @@ from songs.models import Song from marietje.models import User +CACHE_TTL = 2 * 24 * 3600 + def recache_stats(): new_stats = compute_stats() caches['default'].delete('stats') - caches['default'].set('stats', new_stats, 2 * 3600) + caches['default'].set('stats', new_stats, CACHE_TTL) return new_stats @@ -25,7 +27,7 @@ def recache_user_stats(): new_stats = user_stats(user['id']) cacheloc = 'userstats_{}'.format(user['id']) caches['userstats'].delete(cacheloc) - caches['userstats'].set(cacheloc, new_stats, 48 * 3600) + caches['userstats'].set(cacheloc, new_stats, CACHE_TTL) return new_stats