Yeah, the point of my comment was to say this could be clearer.

`while` should loop on something that is a boolean value, namely a method with a ?

I think the problem is probably that the cache method does to much and the name can't possibly encapsulate all three actions.