Fix generating the cache in production environment

Marking the classes for reload works only when cache_classes are set
to false. Otherwise some strange errors when loading the controllers
again might occur.
Merge pull request #223 from iNecas/fix-cache-generation

Fix generating the cache in production environment