Create CachingFactory
Create another implementation of Factory for lifecycle management of objects. Creating a new one should take in an object the implements the factory interface and return the CachingFactory. Every method should do something like check if it has the return object in a pool, and return that object if so. If not, it should call the same function on the factory object passed in at create time, cache the return object in the pool, and return that object.
See more info here.
Edited by Andrew Shoell