Cache when there is no metadata for a class

What this changes:

* In debug, the factory will try to load the metadata of a class only once (per request) if there is none, instead of multiple times
* In debug=false, the factory will try to load the metadata of a class only once until the cache is cleared (among multiple requests)

There should be way less `file_exists` going on :)