Move cache purge code back to Factory class.