def cache_generator(self, key, generator):
results = []<EOL>for result in generator:<EOL><INDENT>results.append(result)<EOL>yield result<EOL><DEDENT>self.inferred[key] = tuple(results)<EOL>
Cache result of generator into dictionary

        Used to cache inference results