Prefer XDG_CACHE_HOME over ~/.cache if set

Further functionality based on #478

per http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Merge pull request #491 from bluehavana/master

Prefer XDG_CACHE_HOME over ~/.cache if set