Making .cache on context more consistent

It caches ```.first``` ```.last``` ```.exists?``` only when cache is true.
[Fix #2667]