Simplified method for caching ancestors.