Handling connection errors as cache misses in 3.2.x

I've backported 2cd4729 to 3.2.x.