Improve caching calculations.