AccumulatorCache: fix cache statistics if exception is thrown
Compare changes
Ensure that cache statistics collection also works in case the decorated function throws an exception and add unit test for this.
Thanks to @smh for the report.