Add test for clearing the cache after uncaught exceptions
Merge branch 'cache_tests' into uncaught_exceptions