Implementing a cache and network race