Write statistics to cache file is option is set in config

It's a bit crude, so no worries if you don't merge it in. Is nice to have for our repos with 60k+ commits however.