mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 00:22:21 +01:00
Add caching for song searching
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from django.core.cache import cache
|
||||
from django.core.cache import caches
|
||||
from django.conf import settings
|
||||
from django.db.models import Count, Q
|
||||
from django.shortcuts import render
|
||||
@ -12,8 +12,8 @@ from songs.models import Song
|
||||
|
||||
def recache_stats():
|
||||
new_stats = compute_stats()
|
||||
cache.delete('stats')
|
||||
cache.set('stats', new_stats, 7200)
|
||||
caches['default'].delete('stats')
|
||||
caches['default'].set('stats', new_stats, 7200)
|
||||
return new_stats
|
||||
|
||||
def compute_stats():
|
||||
|
||||
Reference in New Issue
Block a user