Skip to content

Commit 428a216

Browse files
committed
fetch: --no-cache should be evaluated first, superseding all other cache options
1 parent b587938 commit 428a216

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/cmd/fetch.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ struct Args {
301301
flag_progressbar: bool,
302302
}
303303

304+
// set memcache size - the default is 2 million entries
305+
// and is set through the docopt usage text
304306
static MEM_CACHE_SIZE: OnceLock<usize> = OnceLock::new();
305307

306308
// connect to Redis at localhost, using database 1 by default when --redis is enabled
@@ -417,7 +419,9 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
417419
String::new()
418420
};
419421

420-
let cache_type = if args.flag_disk_cache {
422+
let cache_type = if args.flag_no_cache {
423+
CacheType::None
424+
} else if args.flag_disk_cache {
421425
// if --flush-cache is set, flush the cache directory first if it exists
422426
if args.flag_flush_cache
423427
&& !diskcache_dir.is_empty()
@@ -465,8 +469,6 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
465469
info!("flushed Redis database.");
466470
}
467471
CacheType::Redis
468-
} else if args.flag_no_cache {
469-
CacheType::None
470472
} else {
471473
CacheType::InMemory
472474
};

0 commit comments

Comments
 (0)