Improve cache concurrency
Implements #1017
Merge pull request #1019 from emmanuel-keller/1.6

Bug fixes and improvement