Implements clear() method in factories to prune cached objects