Merge pull request #14512 from edx/beryl/cbs_waffled_manager

Storage-backed Versioned Block Structures: Manager and Store
This commit is contained in:
Nimisha Asthagiri
2017-03-01 10:26:56 -05:00
committed by GitHub
18 changed files with 532 additions and 273 deletions

View File

@@ -25,7 +25,7 @@ def update_course_in_cache(course_key):
block_structure.updated_collected function that updates the block
structure in the cache for the given course_key.
"""
return get_block_structure_manager(course_key).update_collected()
return get_block_structure_manager(course_key).update_collected_if_needed()
def clear_course_from_cache(course_key):

View File

@@ -1,9 +1,9 @@
"""
Helpers for Course Blocks tests.
"""
from openedx.core.lib.block_structure.cache import BlockStructureCache
from openedx.core.djangolib.testing.waffle_utils import override_switch
from openedx.core.lib.block_structure.exceptions import BlockStructureNotFound
from openedx.core.lib.block_structure.store import BlockStructureStore
from ..api import get_cache
from ..config import _bs_waffle_switch_name
@@ -14,7 +14,11 @@ def is_course_in_block_structure_cache(course_key, store):
Returns whether the given course is in the Block Structure cache.
"""
course_usage_key = store.make_course_usage_key(course_key)
return BlockStructureCache(get_cache()).get(course_usage_key) is not None
try:
BlockStructureStore(get_cache()).get(course_usage_key)
return True
except BlockStructureNotFound:
return False
class override_config_setting(override_switch): # pylint:disable=invalid-name