only cache during the right lifecycle phase