From e9052dc2fb3860e99edd08446fbdc2f469c71bdc Mon Sep 17 00:00:00 2001 From: Nimisha Asthagiri Date: Fri, 9 May 2014 14:10:59 -0400 Subject: [PATCH] Fix delete cache so it also deletes location with run = None. --- common/djangoapps/cache_toolbox/core.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/cache_toolbox/core.py b/common/djangoapps/cache_toolbox/core.py index 3321f83d5e..a0a512ca68 100644 --- a/common/djangoapps/cache_toolbox/core.py +++ b/common/djangoapps/cache_toolbox/core.py @@ -118,4 +118,9 @@ def get_cached_content(location): def del_cached_content(location): - cache.delete(unicode(location).encode("utf-8")) + # delete content for the given location, as well as for content with run=None. + # it's possible that the content could have been cached without knowing the + # course_key - and so without having the run. + cache.delete_many( + [unicode(loc).encode("utf-8") for loc in [location, location.replace(run=None)]] + )