prevent reads interacting with writes using a locking solution (ported over from persistentcachingmap)