Added clean option for cached-instances in factory