Make access to the dependency cache threadsafe.
Address code review comments.