Fix #117: Use django-cacheops to cache common ORM requests

This commit is contained in:
Eliot Berriot 2018-03-08 23:20:13 +01:00
parent c70ab72bc0
commit a448eaaf17
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
5 changed files with 15 additions and 0 deletions

View file

@ -60,6 +60,7 @@ THIRD_PARTY_APPS = (
'mptt',
'dynamic_preferences',
'django_filters',
'cacheops',
)
@ -369,6 +370,15 @@ MUSICBRAINZ_CACHE_DURATION = env.int(
'MUSICBRAINZ_CACHE_DURATION',
default=300
)
CACHEOPS_REDIS = env('CACHE_URL', default=CACHE_DEFAULT)
CACHEOPS_ENABLED = env.bool('CACHEOPS_ENABLED', default=True)
CACHEOPS = {
'music.artist': {'ops': 'all', 'timeout': 60 * 60},
'music.album': {'ops': 'all', 'timeout': 60 * 60},
'music.track': {'ops': 'all', 'timeout': 60 * 60},
'music.trackfile': {'ops': 'all', 'timeout': 60 * 60},
'taggit.tag': {'ops': 'all', 'timeout': 60 * 60},
}
# Custom Admin URL, use {% url 'admin:index' %}
ADMIN_URL = env('DJANGO_ADMIN_URL', default='^api/admin/')