Allow setting the cache directory in the config

This allows people set the cache directory in the config. If someone only sets the root directory, but doesn't set the cache directory, the old behaviour remains, and getting the cache directory will return the root directory.