mirror of
https://github.com/sbt/sbt.git
synced 2026-08-28 17:13:56 +02:00
Merge pull request #8158 from eed3si9n/fport/coursier
[2.x] fport: Ensure caching uses weak references
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
package lmcoursier.internal
|
||||
|
||||
import java.io.File
|
||||
import java.util.GregorianCalendar
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.{ Collections, GregorianCalendar, WeakHashMap }
|
||||
import coursier.cache.CacheUrl
|
||||
import coursier.{ Attributes, Dependency, Module, Project, Resolution }
|
||||
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 = {
|
||||
|
||||
val cache = new ConcurrentHashMap[K, V]
|
||||
val cache = Collections.synchronizedMap(new WeakHashMap[K, V])
|
||||
|
||||
key =>
|
||||
val previousValueOpt = Option(cache.get(key))
|
||||
|
||||
Reference in New Issue
Block a user