learningequality/ka-lite — pull request #1101 by bcipolli (2013-11-23 09:51:29+00:00)
Title: Refactoring and reformulating caching scheme on topic tree data, to balance between correctness and efficiency.

On the way to dubbed videos as well... Addresses #1097.

This makes loading of video existence on disk, video urls, and video counts:
* more efficient (done purely on demand, in a piece-wise fashion, and whenever it can be reused, it is)
* more correct (rather than over-caching on every thread, this code will never cache topic data for topic pages with leaves (exercises, and videos), exercise pages, and video pages.

This solves the most essential cross-browser caching cases, and provides a central place that could solve them all.

Testing (with multiple videos installed, so pages with and without videos are visible):
* Start server, go to homepage first, traverse down
* Start server, go to an intermediate topic page first, traverse to the home
* Start server, go to a topic page with leaves first, then traverse both up (to homepage) and down (to videos & exercises)
* Start server, go to an exercise or video first, then traverse up

I don't think further testing is needed, unless @wangguang is in the mood.

@aronasorman this is now in your wheelhouse :)