only cache if needed