Skip to content

Commit

Permalink
fix: fix AttributeError when LocMemCache uses in tests (#2524)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan authored Mar 29, 2024
1 parent 108a012 commit 56ee364
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2298,4 +2298,6 @@ def drop_course_sidebar_blocks_cache(course_id: str):
"""
Drop the course sidebar blocks cache for the given course.
"""
cache.delete_many(cache.iter_keys(f"course_sidebar_blocks_{course_id}*"))
cache_key_prefix = f"course_sidebar_blocks_{course_id}"
all_cache_keys = cache.keys('*') if hasattr(cache, 'keys') else []
cache.delete_many(filter(lambda key: key.startswith(cache_key_prefix), all_cache_keys))

0 comments on commit 56ee364

Please sign in to comment.