It is better to have a caching mechanism inside or outside of a Factory class?
问题 my question here is not strictly language related, it is more a general programming concept. If I have a Factory class that has a method to return Parser objects, and these parser classes ,I know, do not need to be instantiated more than once per iteration cycle (outside of the factory, of course). It is better, in terms of use and object separation to create a caching mechanisms for all the instantiated Parsers inside of the Factory, ie: during the method call, or outside of it, when the