Refactor git_cache to use an rwlock

This significantly reduces contention when many threads are trying to
read from the cache simultaneously.
Merge pull request #2537 from libgit2/reduce-cache-contention

Refactor git_cache to use an rwlock