Skip to content

Commit

Permalink
Updated caches to fit 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Voronov committed Jan 11, 2021
1 parent 0a32eda commit 7f2b462
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/scala/io/iohk/ethereum/db/cache/LruCache.scala
Expand Up @@ -6,7 +6,7 @@ import io.iohk.ethereum.utils.Config.NodeCacheConfig
import com.google.common.cache
import com.google.common.cache.{CacheBuilder, RemovalNotification}

import scala.collection.JavaConverters.asScalaIterator
import scala.jdk.CollectionConverters._
import scala.concurrent.duration.FiniteDuration

class LruCache[K <: AnyRef, V <: AnyRef](
Expand All @@ -27,11 +27,11 @@ class LruCache[K <: AnyRef, V <: AnyRef](
)
.build()

override def drain(): Seq[(K, V)] = {
override def drain: Seq[(K, V)] = {
this.lastClear = System.nanoTime()
val mapView = lruCache.asMap
val iter = mapView.entrySet.iterator
val result = asScalaIterator(iter).map { e =>
val result = iter.asScala.map { e =>
val key = e.getKey
val value = mapView.remove(key)
key -> value
Expand Down
3 changes: 0 additions & 3 deletions src/main/scala/io/iohk/ethereum/db/cache/MapCache.scala
@@ -1,10 +1,7 @@
package io.iohk.ethereum.db.cache

import java.util.concurrent.TimeUnit

import io.iohk.ethereum.utils.Config.NodeCacheConfig

import scala.collection.Seq
import scala.collection.concurrent.{TrieMap, Map => CMap}
import scala.concurrent.duration.FiniteDuration

Expand Down

0 comments on commit 7f2b462

Please sign in to comment.