Php Factory Pattern and cache