edx/edx-platform — pull request #2314 by dmitchell (2014-01-26 13:27:39+00:00)
Title: Cache course location translations

@ormsbee @chrisndodge @cpennington Ok, now this is ready to review. Sorry for the not quite ready version yesterday. After 24h of game jam development on the small mac screen, my eyes weren't working well enough. This one is against release as it should be.

This reduces the mongo db queries for accessing 6.002 from around 1100 on courseware page to 7. I still want to keep has_access from querying for instructor and staff access until it's failed on the student access query. I also want to perhaps memoize the ...Role() instantiation as it has no dependency on request nor user just course.

I have unit tests for the translate_location_to_course_locator on master. I could pull those over as well. This version differs from master in that this uses caching whereas the one on master explicitly says it shouldn't (I hadn't thought of using this approach).

As to query count unit tests, we should discuss w/ @wedaly and others b/c it involves reconfiguring middleware and will make the tests a lot slower. I think we may want to do a separate suite of perf tests which use query counting only for the perf tests.