Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
AN-8701 Increase course_summaries cache timeout to 1 hour (#663)
Browse files Browse the repository at this point in the history
* Increase default cache timeout to 1 hour

* Only increase timeout for summaries.

Also sets local cache to a DummyCache.

* Revert local.py DummyCache setting

* Update api-client to 0.11.0

* Revert "Update api-client to 0.11.0"

This reverts commit e719968.

Accidentally committed to wrong branch.
  • Loading branch information
thallada authored Apr 25, 2017
1 parent dbdd09c commit 0037dad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion analytics_dashboard/courses/presenters/course_summaries.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.conf import settings
from django.core.cache import cache
from courses.presenters import BasePresenter

Expand Down Expand Up @@ -28,7 +29,7 @@ def _get_all_summaries(self):
all_summaries = [
{field: ('' if val is None and field in self.NON_NULL_STRING_FIELDS else val)
for field, val in summary.items()} for summary in all_summaries]
cache.set(self.CACHE_KEY, all_summaries)
cache.set(self.CACHE_KEY, all_summaries, settings.COURSE_SUMMARIES_CACHE_TIMEOUT)
return all_summaries

def _get_last_updated(self, summaries):
Expand Down
4 changes: 4 additions & 0 deletions analytics_dashboard/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,3 +480,7 @@
# Default (None) includes all available fields, in alphabetical order.
LEARNER_API_LIST_DOWNLOAD_FIELDS = None
########## END LEARNER_API_LIST_DOWNLOAD_FIELDS

########## CACHE CONFIGURATION
COURSE_SUMMARIES_CACHE_TIMEOUT = 3600 # 1 hour timeout
########## END CACHE CONFIGURATION
2 changes: 1 addition & 1 deletion analytics_dashboard/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# See: https://docs.djangoproject.com/en/dev/ref/settings/#caches
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
}
}
########## END CACHE CONFIGURATION
Expand Down

0 comments on commit 0037dad

Please sign in to comment.