Change cache file owner, group and mode.

* Use `puppet:puppet` as default user/group
* Use 750 as default cache file mode
* Change cache file ownership for every saved file

* Refactor creating cache files into separate function.