Use home_cache if root_cache is not writable

This PR is composed of two commits.
+ The first commit uses `home_cache` if `root_cache` is not writable, which is typical on Linux—`/var/cache` is not world writable, and Linuxbrew usually doesn't use sudo.
+ The second commit changes the values of `root_cache` and `home_cache` to `/var/cache` and `~/.cache` on Linux.