mirror of https://github.com/sbt/sbt.git
Merge pull request #8158 from eed3si9n/fport/coursier
[2.x] fport: Ensure caching uses weak references
This commit is contained in:
commit
8dac9db39e
|
|
@ -1,8 +1,7 @@
|
||||||
package lmcoursier.internal
|
package lmcoursier.internal
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.GregorianCalendar
|
import java.util.{ Collections, GregorianCalendar, WeakHashMap }
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
|
||||||
import coursier.cache.CacheUrl
|
import coursier.cache.CacheUrl
|
||||||
import coursier.{ Attributes, Dependency, Module, Project, Resolution }
|
import coursier.{ Attributes, Dependency, Module, Project, Resolution }
|
||||||
import coursier.core.{ Classifier, Configuration, Extension, Info, Publication, Type }
|
import coursier.core.{ Classifier, Configuration, Extension, Info, Publication, Type }
|
||||||
|
|
@ -18,7 +17,7 @@ private[internal] object SbtUpdateReport {
|
||||||
|
|
||||||
private def caching[K, V](f: K => V): K => V = {
|
private def caching[K, V](f: K => V): K => V = {
|
||||||
|
|
||||||
val cache = new ConcurrentHashMap[K, V]
|
val cache = Collections.synchronizedMap(new WeakHashMap[K, V])
|
||||||
|
|
||||||
key =>
|
key =>
|
||||||
val previousValueOpt = Option(cache.get(key))
|
val previousValueOpt = Option(cache.get(key))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue