From f46581288f093168e3bc13478d783af318085cb2 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Mon, 25 Jul 2016 00:19:03 +0200 Subject: [PATCH] Enable TTL for changing artifacts by default --- cache/src/main/scala/coursier/CachePolicy.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cache/src/main/scala/coursier/CachePolicy.scala b/cache/src/main/scala/coursier/CachePolicy.scala index da83b4e6a..a9ec3445e 100644 --- a/cache/src/main/scala/coursier/CachePolicy.scala +++ b/cache/src/main/scala/coursier/CachePolicy.scala @@ -13,6 +13,8 @@ object CachePolicy { * * If no local file is found, *don't* try download it. Updates are only checked for files already * in cache. + * + * Follows the TTL parameter (assumes no update is needed if the last one is recent enough). */ case object LocalUpdateChanging extends CachePolicy @@ -22,6 +24,8 @@ object CachePolicy { * If no local file is found, *don't* try download it. Updates are only checked for files already * in cache. * + * Follows the TTL parameter (assumes no update is needed if the last one is recent enough). + * * Unlike `LocalUpdateChanging`, all found local files are checked for updates, not just the * changing ones. */ @@ -31,12 +35,16 @@ object CachePolicy { * Pick local files, and download the missing ones. * * For changing ones, check for updates, and download those if any. + * + * Follows the TTL parameter (assumes no update is needed if the last one is recent enough). */ case object UpdateChanging extends CachePolicy /** * Pick local files, download the missing ones, check for updates and download those if any. * + * Follows the TTL parameter (assumes no update is needed if the last one is recent enough). + * * Unlike `UpdateChanging`, all found local files are checked for updates, not just the changing * ones. */ @@ -58,7 +66,11 @@ object CachePolicy { private val baseDefault = Seq( + // first, try to update changing artifacts that were previously downloaded (follows TTL) + CachePolicy.LocalUpdateChanging, + // then, use what's available locally CachePolicy.LocalOnly, + // lastly, try to download what's missing CachePolicy.FetchMissing )