Make the app cache creation code more isolated