Performance improvements for caching