Commit 3f52261b by Chris Dodge

hmmm. actually, we should only write out to memcache if we've recomputed.…

hmmm. actually, we should only write out to memcache if we've recomputed. Otherwise, a memcache hit will end up writing back to memcache...
parent d448aa13
...@@ -350,8 +350,14 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -350,8 +350,14 @@ class MongoModuleStore(ModuleStoreBase):
if not tree: if not tree:
# if not in subsystem, or we are on force refresh, then we have to compute # if not in subsystem, or we are on force refresh, then we have to compute
tree = self.compute_metadata_inheritance_tree(location) tree = self.compute_metadata_inheritance_tree(location)
# now write out computed tree to caching subsystem (e.g. memcached), if available
if self.metadata_inheritance_cache_subsystem is not None:
self.metadata_inheritance_cache_subsystem.set(key, tree)
# now populate a request_cache, if available # now populate a request_cache, if available. NOTE, we are outside of the
# scope of the above if: statement so that after a memcache hit, it'll get
# put into the request_cache
if self.request_cache is not None: if self.request_cache is not None:
# we can't assume the 'metadatat_inheritance' part of the request cache dict has been # we can't assume the 'metadatat_inheritance' part of the request cache dict has been
# defined # defined
...@@ -359,10 +365,6 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -359,10 +365,6 @@ class MongoModuleStore(ModuleStoreBase):
self.request_cache.data['metadata_inheritance'] = {} self.request_cache.data['metadata_inheritance'] = {}
self.request_cache.data['metadata_inheritance'][key] = tree self.request_cache.data['metadata_inheritance'][key] = tree
# now write to caching subsystem (e.g. memcached), if available
if self.metadata_inheritance_cache_subsystem is not None:
self.metadata_inheritance_cache_subsystem.set(key, tree)
return tree return tree
def refresh_cached_metadata_inheritance_tree(self, location): def refresh_cached_metadata_inheritance_tree(self, location):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment