Remove cache if build fails

Also, we follow the Go style and generally begin doc comments with the name of the thing being documented, so like `// flushCache foos the bar...`.