mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 23:02:21 +01:00
@ -10,10 +10,12 @@ from songs.models import Song
|
|||||||
from marietje.models import User
|
from marietje.models import User
|
||||||
|
|
||||||
|
|
||||||
|
CACHE_TTL = 2 * 24 * 3600
|
||||||
|
|
||||||
def recache_stats():
|
def recache_stats():
|
||||||
new_stats = compute_stats()
|
new_stats = compute_stats()
|
||||||
caches['default'].delete('stats')
|
caches['default'].delete('stats')
|
||||||
caches['default'].set('stats', new_stats, 2 * 3600)
|
caches['default'].set('stats', new_stats, CACHE_TTL)
|
||||||
return new_stats
|
return new_stats
|
||||||
|
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ def recache_user_stats():
|
|||||||
new_stats = user_stats(user['id'])
|
new_stats = user_stats(user['id'])
|
||||||
cacheloc = 'userstats_{}'.format(user['id'])
|
cacheloc = 'userstats_{}'.format(user['id'])
|
||||||
caches['userstats'].delete(cacheloc)
|
caches['userstats'].delete(cacheloc)
|
||||||
caches['userstats'].set(cacheloc, new_stats, 48 * 3600)
|
caches['userstats'].set(cacheloc, new_stats, CACHE_TTL)
|
||||||
return new_stats
|
return new_stats
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user