[2.0] Fixes race between reading into cache and commit updating the cache

This is supposed to go into 2.1, but since the problem exists in all versions of Neo4j, and the fix is the same for 2.0 as 2.1 I'm taking this via 2.0.