Change the central cache to store at two levels: first by scope, then by cache key

This commit is contained in:
Calen Pennington
2015-04-08 16:48:43 -04:00
parent 645d2a727f
commit 0d37ec8099
2 changed files with 19 additions and 14 deletions

View File

@@ -230,7 +230,7 @@ class TestMissingStudentModule(TestCase):
def test_set_field_in_missing_student_module(self):
"Test that setting a field in a missing StudentModule creates the student module"
self.assertEquals(0, len(self.field_data_cache.cache))
self.assertEquals(0, sum(len(cache) for cache in self.field_data_cache.cache.values()))
self.assertEquals(0, StudentModule.objects.all().count())
# We are updating a problem, so we write to courseware_studentmodulehistory
@@ -238,7 +238,7 @@ class TestMissingStudentModule(TestCase):
with self.assertNumQueries(6):
self.kvs.set(user_state_key('a_field'), 'a_value')
self.assertEquals(1, len(self.field_data_cache.cache))
self.assertEquals(1, sum(len(cache) for cache in self.field_data_cache.cache.values()))
self.assertEquals(1, StudentModule.objects.all().count())
student_module = StudentModule.objects.all()[0]