Prefer XDG_CACHE_HOME over ~/.cache if set

Further functionality based on #478

per http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html