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