[PERF-344] Add versioning of cached course assets to allow graceful cache invalidation

When releasing the versioned assets work, we stumbled on a problem with old pickled
versions of the StaticContent objects residing in cache, which triggered a bug in the
code. Not wanting to blow away all cached items, we ended up having to revert and add
in some backwards-compatible helper code to ease the transition.

With this, we'll now utilize the version argument that Django's caching interface
allows, in conjunction with a constant value that can be modified when breaking changes
are being made, to let us gracefully ignore older cached course assets.
This commit is contained in:
Toby Lawrence
2016-06-30 00:15:19 -04:00
parent d328328ff4
commit 4e22affb24
8 changed files with 62 additions and 32 deletions

View File

@@ -1,4 +1,7 @@
from cache_toolbox.core import get_cached_content, set_cached_content, del_cached_content
"""
Tests core caching facilities.
"""
from contentserver.caching import get_cached_content, set_cached_content, del_cached_content
from opaque_keys.edx.locations import Location
from django.test import TestCase

View File

@@ -10,7 +10,7 @@ from django.views.decorators.http import require_http_methods, require_POST
from django.conf import settings
from edxmako.shortcuts import render_to_response
from cache_toolbox.core import del_cached_content
from contentserver.caching import del_cached_content
from contentstore.utils import reverse_course_url
from xmodule.contentstore.django import contentstore

View File

@@ -13,7 +13,7 @@ from django.test.utils import override_settings
from django.conf import settings
from contentstore.tests.utils import CourseTestCase, mock_requests_get
from cache_toolbox.core import del_cached_content
from contentserver.caching import del_cached_content
from xmodule.modulestore.django import modulestore
from xmodule.contentstore.django import contentstore
from xmodule.contentstore.content import StaticContent