Factored out common resource cache functionality, added limits to simultaneous downloading (prioritized by distance).  Closes #2122.