Change the ModuleCache to only take the lock for actual compilation.

Also, once we acquire the lock do a refresh of the cache and try to
pick up modules compiled by others.