Intelligent method caching