Adding conditional around cache_dir so it is only added if a cache_size is specified