Fix cache file option

The user provided cache file option should always have precedence over
the default cache file path.

Signed-off-by: Ralf Horstmann <ralf+github@ackstorm.de>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Refactor cache file creation into separate function.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>